【问题标题】:Integration error while posting message on friends wall?在朋友墙上发布消息时出现集成错误?
【发布时间】:2012-12-06 14:16:44
【问题描述】:

我正在使用 facebook_skd_3.1 (Xcode ios 4.5) 我通过调用获得了朋友列表 FBFriendPickerViewController,在点击完成按钮时我试图发布消息
在选定的朋友墙上,但我收到了这个错误:- 警告:尝试从视图控制器中关闭 正在进行演示或解散时!
2012-12-06 19:37:09.187 ........项目 [5474:19a03] 错误:HTTP 状态代码:403

警报视图中的错误

 error =Error Domain=com.facebook.sdk code=5" ..........
 message = "(#200)the user hasn't authorized the application to perform this action";
 type = OAuthException
 };
 };

 code=403;

 com.acebook.sdk:HTTPStatuscode=403}

代码:-

  -(void)facebookViewControllerDoneWasPressed:(id)sender {
  NSString* userid;

  for (id<FBGraphUser> user in self.friendPickerController.selection)
    {
        NSLog(@"\nuser=%@\n", user);
     userid = user.id;


    }

  NSMutableDictionary* dictaram = [[NSMutableDictionary alloc]
    initWithObjectsAndKeys:@"like this!", @"message", nil];
  [FBRequestConnection startWithGraphPath:[NSString stringWithFormat:@"%@/feed", userid] 
       parameters:params HTTPMethod:@"POST"  
  completionHandler:^(FBRequestConnection *connection, id result, NSError *error)
  {

      UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Shared"
      message:[NSString     stringWithFormat:@ %@! error=%@", fbUserName, error]
                                                        delegate:nil
                                              cancelButtonTitle:@"OK"
                                               otherButtonTitles:nil];
      [alertView show];
   }
   ];

   [self dismissModalViewControllerAnimated:YES];

我需要一些权限还是有一些编码错误请帮忙。

提前致谢。

【问题讨论】:

标签: iphone ios facebook ios5


【解决方案1】:

请延迟一段时间后关闭视图控制器。

【讨论】:

    【解决方案2】:

    我已经通过在委托中重新授权权限来解决这个问题,我已经读取了会话的权限,因此不适用于发布。将以下代码写入 ButtonAction 中,您将获得正确的输出。

     NSArray *permissions =[NSArray arrayWithObjects:@"publish_actions",@"publish_stream",@"manage_friendlists", nil];
    
    [[FBSession activeSession] reauthorizeWithPublishPermissions:permissions defaultAudience:FBSessionDefaultAudienceFriends
                                               completionHandler:^(FBSession *session, NSError *error) {
                                                   /* handle success + failure in block */
                                               }];
    

    【讨论】:

      猜你喜欢
      • 2012-04-29
      • 2012-04-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多