【发布时间】:2016-06-21 16:29:06
【问题描述】:
我正在使用适用于 iOS 的 Facebook SDK 4.13。
我已通过[FBSDKShareAPI share] 成功分享自定义 OpenGraph 故事。问题是 - 没有对话框。
当我尝试通过FBSDKShareDialog 分享相同的上下文时 - 对话框显示为空且共享帖子也不显示。
是否有可能通过对话分享 OpenGraph 故事?
【问题讨论】:
我正在使用适用于 iOS 的 Facebook SDK 4.13。
我已通过[FBSDKShareAPI share] 成功分享自定义 OpenGraph 故事。问题是 - 没有对话框。
当我尝试通过FBSDKShareDialog 分享相同的上下文时 - 对话框显示为空且共享帖子也不显示。
是否有可能通过对话分享 OpenGraph 故事?
【问题讨论】:
我已经为我的 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];
}
【讨论】: