【问题标题】:Custom OpenGraph methods failing when posting发布时自定义 OpenGraph 方法失败
【发布时间】:2014-09-01 22:22:36
【问题描述】:

尝试使用带有 FB iOS SDK v 3.17.0 的共享对话框发布到 OpenGraph 时出现以下错误:

Error : Error Domain=com.facebook.Facebook.platform Code=102 "The operation couldn’t be completed. (com.facebook.Facebook.platform error 102.)" UserInfo=0x176d43a0 {error_code=102, error_description=An error occurred during publishing., app_id=xxxxxxxxxxx, error_reason=The operation couldn’t be completed. (FBAPIErrorDomain error 2500.)}

此错误由 presentShareDialogWithOpenGraphAction 方法的处理程序回调返回。调用此方法时,会发生到 FB 应用程序的转换,并且帖子的内容会显示在 UI 中(尽管提供的照片会短暂显示然后消失)。我还在 FB 应用程序中看到一个警告对话框,说明:

Oops, Something Went Wrong. There was a problem posting your status. We've logged the error and will look into it.

在 FB 应用程序中按 Post 后,我的应用程序再次打开并显示上述错误消息。

我正在做的(缩写)代码如下。请注意,我的对象类型是gift,我的自定义方法是send,并且两者似乎都在开发人员网站上正确设置。任何帮助深表感谢。

id<FBGraphObject> object = [FBGraphObject openGraphObjectForPostWithType:@"myNamespace:gift"]
                                        title:@"Gifter"
                                        image:@"http://imgur.com/gallery/Omhe1V3"
                                          url:@"http://www.myAppsUrl.com"
                                  description:@"A gift for you"];
id<FBOpenGraphAction> action = (id<FBOpenGraphAction>)[FBGraphObject graphObject];
[action setObject:object forKey:@"gift"];

[action setTags:@[targetFacebookId]];   ///S.O. Note: The Id is obtained elsewhere. 

FBOpenGraphActionParams *params = [[FBOpenGraphActionParams alloc] init];
params.action = action;
params.actionType = @"myNamespace:send";

// If the Facebook app is installed and we can present the share dialog
if([FBDialogs canPresentShareDialogWithOpenGraphActionParams:params]) {
    // Show the share dialog
    [FBDialogs presentShareDialogWithOpenGraphAction:action
                                          actionType:@"myNamespace:send"
                                 previewPropertyName:@"gift"
                                             handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {

                                                 NSLog(@"Error : %@",error);

                                             }];
}

【问题讨论】:

  • 你解决了吗?我也发生了...

标签: facebook facebook-graph-api ios7 facebook-opengraph fbconnect


【解决方案1】:

仔细查看您提供的参数。 FB 不会告诉您出了什么问题,而只是返回此一般错误。 我只是遇到了同样的问题,显然我的命名空间是错误的。

所以我的建议 - 双重和三重检查你传递给 FB 的所有参数

【讨论】:

    猜你喜欢
    • 2023-03-10
    • 2022-08-17
    • 2017-12-28
    • 1970-01-01
    • 2020-02-23
    • 2021-11-27
    • 2012-12-18
    • 1970-01-01
    • 2012-12-01
    相关资源
    最近更新 更多