2016-06-21 38 views
0

我正在使用Facebook SDK 4.13 for iOS。通过shareDialog或feedDialog分享OpenGraph故事

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

当我试图共享相同的上下文FBSDKShareDialog - 对话框显示为空并且共享后也没有。

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

回答

0

我已经为我的OGOStory(OpenGraphObjectStory)管理了“调整”设置,因此它会以良好的对话框正确显示。 有点令人困惑的是,在我的应用程序中,我有名为的故事和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]; 
}