本文介绍了FBSDKShareDialog应该发布时取消的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在代码中创建了一个FBSDKShareDialog

   - (void)shareWithFacebookDialog; 
{
FBSDKShareLinkContent * content = [[FBSDKShareLinkContent alloc] init];
content.contentURL = [NSURL URLWithString:@Path Redacted];
content.contentTitle = @Title Redacted;
content.contentDescription = @描述已修改;

FBSDKShareDialog * dialog = [[FBSDKShareDialog alloc] init];
[dialog setMode:FBSDKShareDialogModeNative];
[dialog setShareContent:content];
[dialog setDelegate:self];
[dialog setFromViewController:self];
[dialog show];
}

对话框启动,所有信息正确





   - (void)sharerDidCancel: (ID< FBSDKSharing>)共享者; 

有没有人看到这个?找到一种方法来克服它?

解决方案

将代码替换为

   - (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];
}

告诉我是否有效。


I create a FBSDKShareDialog in code

- (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];
}

The dialog launches and all the information is correct

But as soon as Post is tapped the dialog closes and the cancel delegate is called.

- (void)sharerDidCancel:(id<FBSDKSharing>)sharer;

Has anyone seen this? Found a way to overcome it?

解决方案

replace your code with this

- (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];
}

tell me if it works.

这篇关于FBSDKShareDialog应该发布时取消的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-23 14:13