1

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 in the alert view

 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}

code :-

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

enter image description here

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

thanks in advance.

weberc2
  • 7,423
  • 4
  • 41
  • 57
ios Dev
  • 68
  • 7
  • Completely banned by Facebook, early 2013. Irrelevant now. http://stackoverflow.com/questions/5665476/sending-a-private-message-to-your-friends-via-facebook-ios-sdk – Fattie Oct 23 '13 at 10:53

2 Answers2

0

Please dismiss viewcontroller after some delay.

Paramasivan Samuttiram
  • 3,728
  • 1
  • 24
  • 28
0

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 */
                                           }];
ios Dev
  • 68
  • 7