FBSDKShareDialog shareFromViewController 方法在哪里
where is the FBSDKShareDialog shareFromViewController method
下载最新的Facebook SDK并遵循文档:
FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
content.contentURL = [NSURL URLWithString:@"http://developers.facebook.com"];
[FBSDKShareDialog shareFromViewController:self
withContent:content
delegate:nil];
但是有个问题,没有shareFromViewController方法!
只有 showFromViewController 方法,不能做分享工作,分享方法在哪里?
SDK中没有shareFromViewController方法用于sharing.It用于分享的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);
}
下载最新的Facebook SDK并遵循文档:
FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
content.contentURL = [NSURL URLWithString:@"http://developers.facebook.com"];
[FBSDKShareDialog shareFromViewController:self
withContent:content
delegate:nil];
但是有个问题,没有shareFromViewController方法! 只有 showFromViewController 方法,不能做分享工作,分享方法在哪里?
SDK中没有shareFromViewController方法用于sharing.It用于分享的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);
}