【问题标题】:The permission of Facebook post is "Only me" using FBWebDialogsFacebook 帖子的权限是使用 FBWebDialogs 的“只有我”
【发布时间】:2013-04-23 21:32:57
【问题描述】:

我想从 iOS 应用发布文本和链接到用户时间线。我复制并粘贴 FBWebDialogs 示例。

问题 1: 帖子出现在我的时间线中,但权限是“只有我”,不是朋友或公众。

问题 2: 结果对象 (FBWebDialogResult) 为零。日志出现在我的控制台中。NSLog(@"用户取消故事发布。");

问题 3: 预览框的权限是“只有我”,即使我将其设置为公开

我的Facebook页面的附加设置:

这是我的代码:

[FBWebDialogs presentFeedDialogModallyWithSession:nil
                                       parameters:params
                                          handler:
 ^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
     if (error) {
         // Error launching the dialog or publishing a story.
         NSLog(@"Error publishing story.");
     } else {
         if (result == FBWebDialogResultDialogNotCompleted) {
             // User clicked the "x" icon
             NSLog(@"User canceled story publishing.");
         } else {
             // Handle the publish feed callback
             NSDictionary *urlParams = [self parseURLParams:[resultURL query]];
             if (![urlParams valueForKey:@"post_id"]) {
                 NSLog(@"User canceled story publishing.");
             } else {
                 NSString *msg = [NSString stringWithFormat:
                                  @"Posted story, id: %@",
                                  [urlParams valueForKey:@"post_id"]];
                 [[[UIAlertView alloc] initWithTitle:@"Result"
                                             message:msg
                                            delegate:nil
                                   cancelButtonTitle:@"OK!"
                                   otherButtonTitles:nil]
                  show];
             }
         }
     }
 }];

我的应用程序的设置页面默认为“只有我”。我不希望我的所有用户都在这里更改此设置。

【问题讨论】:

    标签: ios objective-c facebook user-permissions


    【解决方案1】:

    天哪。我挣扎了一整天,但没有任何进展。我一问问题就找到了解决方案。

    问题是我复制了不适当的示例代码。我更改为 [FBSession openActiveSessionWithPublishPermissions] 并解决了问题。

    这是我使用的登录代码。我的帖子现在可以公开了。

    - (void)buttonRequestClickHandler:(id)sender {
    // FBSample logic
    // Check to see whether we have already opened a session.
    if (FBSession.activeSession.isOpen) {
        // login is integrated with the send button -- so if open, we send
        //  [self sendRequests];
        NSLog(@"Login in facebook");
    } else {
    
          NSArray *permission = [NSArray arrayWithObjects:@"publish_actions", nil];
        [FBSession openActiveSessionWithPublishPermissions:permission defaultAudience:FBSessionDefaultAudienceEveryone allowLoginUI:YES completionHandler:^(FBSession *session,
                                                          FBSessionState status,
                                                          NSError *error) {
                                          // if login fails for any reason, we alert
                                          if (error) {
                                              UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
                                                                                              message:error.localizedDescription
                                                                                             delegate:nil
                                                                                    cancelButtonTitle:@"OK"
                                                                                    otherButtonTitles:nil];
                                              [alert show];
                                              // if otherwise we check to see if the session is open, an alternative to
                                              // to the FB_ISSESSIONOPENWITHSTATE helper-macro would be to check the isOpen
                                              // property of the session object; the macros are useful, however, for more
                                              // detailed state checking for FBSession objects
                                          } else if (FB_ISSESSIONOPENWITHSTATE(status)) {
                                              // send our requests if we successfully logged in
                                              NSLog(@"Login in facebook");                                          }
                                      }];
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-07-06
      • 1970-01-01
      相关资源
      最近更新 更多