使用Facebook SDK 4.0,如果我在同一个视图控制器上有不同的Facebook共享按钮。
[FBSDKShareDialog showFromViewController:self withContent:content delegate:self];在代理上,我如何使用共享对象知道哪个共享对话框已完成并显示结果?
-(void)sharer:(id<FBSDKSharing>)sharer didCompleteWithResults:(NSDictionary *)results;发布于 2015-05-06 17:52:14
小明,谢谢你的回答。
因此,如果需要这样做,您应该使用实例方法,而不是类方法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
}
}发布于 2015-05-06 02:19:21
委托中的共享者对象是调用showFromViewController:withContent: delegate :方法的FBSDKShareDialog实例。因此,您可以与您的共享对话框实例进行比较,也可以自己进行内部记账(就在您调用showFromViewController:...方法)。
https://stackoverflow.com/questions/30058414
复制相似问题