FBSDKShareDialog在发布时取消

Dam*_*amo 14 facebook objective-c ios

我在代码中创建了一个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];
}
Run Code Online (Sandbox Code Playgroud)

对话框启动并且所有信息都是正确的

在此输入图像描述

但是只要点击Post,对话框就会关闭,并且会调用取消委托.

- (void)sharerDidCancel:(id<FBSDKSharing>)sharer;
Run Code Online (Sandbox Code Playgroud)

有没有人见过这个?找到克服它的方法?

mar*_*ars 9

用这个替换你的代码

- (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];
}
Run Code Online (Sandbox Code Playgroud)

告诉我它是否有效.