1

下载最新的 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方法在哪里?

4

1 回答 1

6

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];

//委托方法

- (void)sharer:(id<FBSDKSharing>)sharer didCompleteWithResults:(NSDictionary *)results{

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

}

- (void)sharer:(id<FBSDKSharing>)sharer didFailWithError:(NSError *)error{
NSLog(@"%@",error);
}
于 2015-05-13T08:04:46.917 回答