I'm trying to implement the share on facebook through the sdk facebook in a Xamarin.forms PCL project. I managed to implement smoothly the share of Android , but I have problems for iOS . In particular, the share of a link works , but nothing happens if I try to do the share of custom objects . I can not find any complete example to help me solve this problem .
Below is my code to share:
ShareOpenGraphObject obj = new MyShareOpenGraphObject ();
obj.SetString("myapp:myobject", "og:type");
obj.SetString (title, "og:title");
obj.SetString ("xxxxxxxxx", "fb:app_id");
obj.SetString (des, "og:description");
ShareOpenGraphAction action = new MyShareOpenGraphAction{
ActionType = "myapp:myaction"
};
action.SetObject(obj, "myapp:myobject");
// Create the content
ShareOpenGraphContent content = new ShareOpenGraphContent{
PreviewPropertyName = "myapp:myobject",
Action = action
};
var shareDialog = new MyShareDialog
{
FromViewController = UIApplication.SharedApplication.KeyWindow.RootViewController,
Mode = ShareDialogMode.Automatic
};
shareDialog.SetShareContent(content);
shareDialog.Show();
Below my classes:
public class MyShareDialog : ShareDialog
{
public MyShareDialog () : base(NSObjectFlag.Empty)
{
}
}
public class MyShareOpenGraphAction : ShareOpenGraphAction
{
public MyShareOpenGraphAction (): base(NSObjectFlag.Empty)
{
}
}
public class MyShareOpenGraphObject: ShareOpenGraphObject
{
public MyShareOpenGraphObject () : base(NSObjectFlag.Empty)
{
}
}