其中是FBSDKShareDialog shareFromViewController方法

时间:2015-05-13 07:44:44

标签: 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方法,它不能做共享工作,共享方法在哪里?

1 个答案:

答案 0 :(得分:6)

SDK中没有用于共享的shareFromViewController方法。它是用于共享的showFromViewController方法。

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

OR

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);
}