【问题标题】:Share OpenGraph story by shareDialog or feedDialog通过分享对话框或提要对话框分享 Open Graph 故事
【发布时间】:2016-06-21 16:29:06
【问题描述】:

我正在使用适用于 iOS 的 Facebook SDK 4.13。

我已通过[FBSDKShareAPI share] 成功分享自定义 OpenGraph 故事。问题是 - 没有对话框。

当我尝试通过FBSDKShareDialog 分享相同的上下文时 - 对话框显示为空且共享帖子也不显示。

是否有可能通过对话分享 OpenGraph 故事?

【问题讨论】:

    标签: ios facebook-graph-api


    【解决方案1】:

    我已经为我的 OGOStory(OpenGraphObjectStory) 管理了“调整”设置,因此它会在良好的对话框中正确显示。 有点令人困惑的是,在我的应用中,我有名为 story 和 OGOS 的模型,但我希望你能理解。

    - (void)performShareFacebookWithStory:(STLStory *)story andText:(NSString *)text
    {
        NSURL *imageURL = [NSURL URLWithString:[story largeImageURL]];
        FBSDKSharePhoto *photo = [FBSDKSharePhoto photoWithImageURL:imageURL userGenerated:NO];
        NSDictionary *properties = @{
                                     @"og:type": @"stories_california:story", //OpenGraphObjectStory,
                                     @"og:title": [story title],
                                     @"og:description": [story aboutText],
                                     @"og:url": [self storyUrlForStory:story], // it's NSString
                                     @"og:image": @[photo],
                                     };
        FBSDKShareOpenGraphObject *object = [FBSDKShareOpenGraphObject objectWithProperties:properties];
    
        FBSDKShareOpenGraphAction *action = [[FBSDKShareOpenGraphAction alloc] init];
        action.actionType = @"stories_california:story_listen";
        [action setObject:object forKey:@"story"];
    
        FBSDKShareOpenGraphContent *content = [[FBSDKShareOpenGraphContent alloc] init];
        content.action = action;
        content.previewPropertyName = @"story"; //OpenGraphPreviewPropertyName
    
        [FBSDKShareDialog showFromViewController:_parentVC
                                     withContent:content
                                        delegate:self];
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-05-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-13
      • 1970-01-01
      相关资源
      最近更新 更多