无法使用iOS中的FB SDK创建自定义打开图表故事

时间:2015-08-12 09:40:13

标签: ios facebook facebook-graph-api facebook-ios-sdk

我正在尝试使用facebook SDK的Graph API通过我的应用发布故事。 我已经在其App控制台上配置了操作,对象和故事,并实现了以下代码来实现相同的目标。

 NSURL *imageURL = [NSURL URLWithString:@"https://fbstatic-a.akamaihd.net/images/devsite/attachment_blank.png"];
    FBSDKSharePhoto *photo = [FBSDKSharePhoto photoWithImageURL:imageURL userGenerated:NO];
    NSDictionary *properties = @{
                                 @"og:type": @"abc-holdings:glc",
                                 @"og:title": @"Sample GLC",
                                 @"og:description": @"Test Geo",
                                 @"og:url": @"http://samples.ogp.me/147425295593678",
                                 @"og:image": @[photo],
                                 @"abc-holdings:location:longitude":@(-58.381667),
                                 @"abc-holdings:location:latitude":@(23.381667)
                                 };
    FBSDKShareOpenGraphObject *object = [FBSDKShareOpenGraphObject objectWithProperties:properties];

    FBSDKShareOpenGraphAction *action = [FBSDKShareOpenGraphAction actionWithType:@"abc-holdings:has_a_glc" object:object key:@"glc"];
    [action setString:@"true" forKey:@"fb:explicitly_shared"];


    // Create the content
    FBSDKShareOpenGraphContent *content = [[FBSDKShareOpenGraphContent alloc] init];
    content.action = action;
    content.previewPropertyName = @"glc";

    // Share the content
    FBSDKShareAPI *shareAPI = [[FBSDKShareAPI alloc] init];
    shareAPI.shareContent = content;
    shareAPI.delegate = self;

    [shareAPI share];

但是这个问题是它回复我如下

Error Domain=com.facebook.sdk.share Code=201 "The operation couldn’t be completed. (com.facebook.sdk.share error 201.)" UserInfo=0x7fb9e1749190 {com.facebook.sdk:FBSDKErrorDeveloperMessageKey=Error sharing Open Graph content, NSUnderlyingError=0x7fb9e14c5210 "The operation couldn’t be completed. (com.facebook.sdk.core error 8.)"}

有人对此有任何想法吗?

1 个答案:

答案 0 :(得分:0)

你应该去Facebook看你的应用程序。选择打开图表设置,选择您的操作类型,向下滚动直到结束。在那里,您会看到一些复选框Your action capabilities

选中最后一个复选框,然后尝试再次分享您的内容。