在朋友墙上发布消息时出现集成错误? [英] Integration error while posting message on friends wall?

查看:102
本文介绍了在朋友墙上发布消息时出现集成错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即时通讯使用facebook_skd_3.1(Xcode ios 4.5)我通过调用
FBFriendPickerViewController得到好友列表,点击完成按钮我试图在选定的朋友墙上发布消息

但是我收到此错误: -
警告:在演示或解雇过程中尝试解除视图控制器


2012-12-06 19:37:09.187 .. ......项目[5474:19a03]错误:HTTP状态代码:403

i m using facebook_skd_3.1 (Xcode ios 4.5) i got the friends list by calling FBFriendPickerViewController, on clicking done button i have tried to post the message
on the selected friends wall but i got this error :- Warning: Attempt to dismiss from view controller while a presentation or dismiss is in progress!
2012-12-06 19:37:09.187 ........project[5474:19a03] Error: HTTP status code: 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];

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

Do i need some permissions or there is some coding error please help.

提前感谢。

推荐答案

我通过在委托中重新授权权限,如下所示,我已经读取了会话权限,因此无法发布。请将以下代码写入ButtonAction,您将获得正确的输出。

I have figured it by re authorizing the permissions as follows in delegate i have read permissions for session so that didn't worked for posting. write the following code to in the ButtonAction and you will get the proper output.

 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 */
                                           }];

这篇关于在朋友墙上发布消息时出现集成错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆