ios - 使用 FacebookSDK 在 Facebook 上仅共享文本的问题

标签 ios iphone facebook facebook-sdk-4.0

在我的应用程序中,我只想在 Facebook 上共享文本。为此,我正在使用 FacebookSDK。

我的代码如下:

NSDictionary *params = @{
                   @"name" :[NSString stringWithFormat:@"Jinx Share"],
                   @"caption" : [NSString stringWithFormat:@""],
                   @"description" :@"Some text to share",
                   @"picture" : @"",
                   @"link" : @"",
                   };


     // if the session is closed, then we open it here, and establish a handler for state changes
    [FBSession openActiveSessionWithReadPermissions:nil allowLoginUI:YES completionHandler:^(FBSession *session,FBSessionState state, NSError *error)
     {
         if (error)
         {
             UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error" message:error.localizedDescription delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
             [alertView show];
         }
         else if(session.isOpen)
         {

             // Invoke the dialog
             [FBWebDialogs presentFeedDialogModallyWithSession:nil
                                                    parameters:params
                                                       handler:
              ^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
                  if (error) {
                      //NSLog(@"Error publishing story.");

                  } else {
                      if (result == FBWebDialogResultDialogNotCompleted) {
                          //NSLog(@"User canceled story publishing.");

                      } else {
                          //NSLog(@"Story published.");

                      }
                  }}];
         }

     }];

但是当 facebook 共享对话框打开时,它不会在那里显示任何文本。请看下面的截图

enter image description here

如果我在“图片”参数中给出了任何链接,那么它会显示文本。但我不想显示任何图像。我只想在 Facebook 上分享文字。

我的代码有什么问题?有人可以给我解决方案。

最佳答案

自 4 月份的最新 Facebook SDK 以来,Facebook 不允许您的应用预填充任何要共享的内容。这不符合 Facebook 平台政策,see Facebook Platform Policy, 2.3 .另请参阅此 Sharing through Facebook .

关于ios - 使用 FacebookSDK 在 Facebook 上仅共享文本的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32692785/

相关文章:

ios - 找不到捕获的视频 URL

ios - 在 swift xcode 数组中打印特定字符串时崩溃

iphone - UIDatePicker 在 iPhone 上横向显示为黑色

javascript - 未捕获的异常 : Permission denied to Proxy. InstallTrigger

ios - Parse.com findObjects() 获取数据

ios - 如何将第一个值设置为表格颜色

iphone - 从一个 View 导航到另一个 View 时制作翻转动画

javascript - 未加载 Facebook 聊天插件在控制台中给我错误

ios - 打开邮件、消息、Twitter 或 Facebook 等系统应用程序时,不会调用 UIDocumentInteractionControllerDelegate 方法

ios - UIButton 未显示在 UIViewController 中