下载最新的 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/