2016-06-21 39 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]; 
}