您好我有以下问题。 如果我从iOS应用程序共享一个facebook事件网址(如https://www.facebook.com/events/),我有两个可能性: (1)安装了iOS facebook app (2)未安装iOS facebook app
我的情况1一切正常。 Facebook应用程序获取事件信息,显示正确的预览,并且Facebook墙上的帖子也是正确的。 在案例2中,我使用FBWebDialods类,它显示没有picutre的预览,而Facebook墙上的帖子只是文本。没有图像,没有参加按钮。
有人知道如何在两种情况下在Facebook墙上获得相同的帖子吗?
答案 0 :(得分:0)
我收到https://developers.facebook.com/docs/ios/share/的回复:
// Check if the Facebook app is installed and we can present the share dialog
FBShareDialogParams *params = [[FBShareDialogParams alloc] init];
params.link = [NSURL URLWithString:@"https://developers.facebook.com/docs/ios/share/"];
params.name = @"Sharing Tutorial";
params.caption = @"Build great social apps and get more installs.";
params.picture = [NSURL URLWithString:@"http://i.imgur.com/g3Qc1HN.png"];
params.description = @"Allow your users to share stories on Facebook from your app using the iOS SDK.";
// If the Facebook app is installed and we can present the share dialog
if ([FBDialogs canPresentShareDialogWithParams:params]) {
// Present the share dialog
} else {
// Present the feed dialog
}
并显示您添加的分享对话框:
[FBDialogs presentShareDialogWithLink:params.link
name:params.name
caption:params.caption
description:params.description
picture:params.picture
clientState:nil
handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
if(error) {
// An error occurred, we need to handle the error
// See: https://developers.facebook.com/docs/ios/errors
NSLog([NSString stringWithFormat:@"Error publishing story: %@", error.description]);
} else {
// Success
NSLog(@"result %@", results);
}
}];
我希望这可以帮到你