如果我在同一 View Controller 上有不同的 Facebook 分享按钮,则使用 Facebook SDK 4.0。
[FBSDKShareDialog showFromViewController:self withContent:content delegate:self];
在代理上,我如何使用共享对象知道哪个共享对话框已完成并带有结果?
-(void)sharer:(id<FBSDKSharing>)sharer didCompleteWithResults:(NSDictionary *)results;
最佳答案
感谢您的回答。
因此,如果您需要这样做,您应该使用实例方法而不是类方法 showFromViewController:withContent:delegate:
.h
@property (strong, nonatomic) FBSDKShareDialog *shareCodeDialog;
.m
self.shareCodeDialog = [FBSDKShareDialog new];
[self.shareCodeDialog setDelegate:self];
[self.shareCodeDialog setShareContent:content];
[self.shareCodeDialog setFromViewController:self];
[self.shareCodeDialog show];
-(void)sharer:(id<FBSDKSharing>)sharer didCompleteWithResults:(NSDictionary *)results {
if ([sharer isEqual:self.shareCodeDialog]) {
// Your delegate code
}
}
关于ios - 哪个FBSDKShareDialog didCompleteWithResults?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30058414/