如何知道是否已使用facebook unity sdk在Facebook上成功发布了墙帖?是否有任何条件检查,例如用于登录的FB.isLoggedIn?成功发布内容后如何执行某些操作?
您可以为此使用回调。
FB.Feed("", link, message, caption, linkName, linkToImage, "", "", "", "", null, OnActionShared);
在回调中,如果发布成功与否,您将拥有句柄。
public void OnActionShared(FBResult result){
if(result.Error != null)
{
Debug.LogError("OnActionShared: Error: " + result.Error);
}
if (result == null || result.Error != null)
{
//Do something request failed
}
else
{
var responseObject = Json.Deserialize(result.Text) as Dictionary<string, object>;
object obj = 0;
if (responseObject == null || responseObject.Count <= 0 || responseObject.TryGetValue("cancelled", out obj))
{
Debug.LogWarning("Request cancelled");
//Do something when user cancelled
}
else if (responseObject.TryGetValue("id", out obj) || responseObject.TryGetValue("post_id", out obj))
{
Debug.LogWarning("Request Send");
//Do something it is succeeded
}
}
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句