我用代码创建了一个FBSDKShareDialog
- (void)shareWithFacebookDialog;
{
FBSDKShareLinkContent* content = [[FBSDKShareLinkContent alloc] init];
content.contentURL = [NSURL URLWithString:@"Path Redacted"];
content.contentTitle = @"Title Redacted";
content.contentDescription = @"Description Redacted";
FBSDKShareDialog* dialog = [[FBSDKShareDialog alloc] init];
[dialog setMode:FBSDKShareDialogModeNative];
[dialog setShareContent:content];
[dialog setDelegate:self];
[dialog setFromViewController:self];
[dialog show];
}对话框将启动,所有信息都是正确的。

但是,一旦点击Post,对话框就会关闭,并调用cancel委托。
- (void)sharerDidCancel:(id<FBSDKSharing>)sharer;有人看过这个吗?找到克服它的方法了吗?
发布于 2015-07-03 11:21:19
将您的代码替换为
- (void)shareWithFacebookDialog;
{
FBSDKShareLinkContent content = [[FBSDKShareLinkContent alloc]init];
content.contentURL = [NSURL URLWithString:@"https://www.google.com"];
content.contentTitle = @"ContentTitle";
content.contentDescription = @"ContentDescription";
[FBSDKShareDialog showFromViewController:self
withContent:content
delegate:self];
}告诉我它是否有效。
发布于 2015-06-30 13:21:50
当我试图在登录后立即调用该方法时,我就遇到了这种情况。
FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
[login logInWithPublishPermissions:@[@"publish_actions"] handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
if (error || result.isCancelled) {
} else {
[self shareWithFacebookDialog];
}
}];如果我只是在没有登录的情况下调用它(应该已经有了有效的令牌),它就能工作。
if ([FBSDKAccessToken currentAccessToken]) {
[self shareWithFacebookDialog];
}发布于 2015-07-08 15:47:04
我也有同样的问题:Facebook SDK share always returns sharerDidCancel
我的错误出现在AppDelegate方法中:
下面是与解决方案http://jitu1990.blogspot.it/2015/05/share-with-facebook-from-ios-app.html的链接
这是密码
- (BOOL)application:(UIApplication *)application openURL:(NSURL* )url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
return [[FBSDKApplicationDelegate sharedInstance] application:application
openURL:url sourceApplication:sourceApplication annotation:annotation];
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
[FBSDKAppEvents activateApp];
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
return [ [FBSDKApplicationDelegate sharedInstance] application :application
didFinishLaunchingWithOptions:launchOptions]
}https://stackoverflow.com/questions/31076154
复制相似问题