ios - FBSDKShareDialog shareFromViewController 方法在哪里

标签 ios facebook-ios-sdk facebook-share

下载最新的 Facebook SDK 并遵循文档:

FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
content.contentURL = [NSURL URLWithString:@"http://developers.facebook.com"];
[FBSDKShareDialog shareFromViewController:self
                              withContent:content
                                 delegate:nil];

但是有一个问题,没有 shareFromViewController 方法!
只有showFromViewController方法,不能做share工作,share方法在哪里?

最佳答案

SDK中没有shareFromViewController方法用于分享,是showFromViewController方法用于分享。

[FBSDKShareDialog showFromViewController:self
                                 withContent:tempContent
                                    delegate:self];

或者
FBSDKShareDialog *shareDialog = [[FBSDKShareDialog alloc] init];
shareDialog.delegate=self;
shareDialog.fromViewController = self;
shareDialog.shareContent = content;
[shareDialog show];

//委托(delegate)方法
- (void)sharer:(id<FBSDKSharing>)sharer didCompleteWithResults:(NSDictionary *)results{

}
 - (void)sharerDidCancel:(id<FBSDKSharing>)sharer{

}

- (void)sharer:(id<FBSDKSharing>)sharer didFailWithError:(NSError *)error{
NSLog(@"%@",error);
}

关于ios - FBSDKShareDialog shareFromViewController 方法在哪里,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30208665/

相关文章:

ios - 应用程序设置 FirebaseMessaging 委托(delegate)时应用程序崩溃

swift - IOS Facebook SDK 4.01 : Should I be using FBSDKAccessToken. currentAccessToken() 检查用户是否登录?

swift - 完成错误 - 代码 : -1009 when internet there is no connection

android - Facebook SDK 4.0 分享对话框

ios - CMSampleBufferGetImageBuffer 中的内存泄漏

ios - 从 UITableView 中删除行的正确方法是什么?

ios - Xcode 停止随机识别类类型

ios - Facebook iOS SDK 3.1 |每次用户尝试登录时都会出现 "You have already authorized YOUR_APP"

ios - 如何使我的 SLComposeViewController 可用于服务类型 (Facebook) iOS swift

iOS : activityType doesn't work on UIactivityViewController