2
votes

i have integerated facebook sdk latest, i create App on developer with my acoount ABC ....and use Facebook App id . All is fine if i loging in my Ios app with my ABC account to loging with facebook.it post on my wall successfully .

But if i use any other Account to loging with facebook . i loged in successfully but when i post i got error .

**I am getting this erro**r

Error Domain=com.facebook.sdk Code=5 "The operation couldn’t be completed. (com.facebook.sdk error 5.)" UserInfo=0x22689930 {com.facebook.sdk:HTTPStatusCode=403, com.facebook.sdk:ParsedJSONResponseKey={ body = { error = { code = 200; message = "(#200) The user hasn't authorized the application to perform this action"; type = OAuthException; }; }; code = 403; }, com.facebook.sdk:ErrorSessionKey=, expirationDate: 2014-08-15 08:56:01 +0000, refreshDate: 2014-06-16 10:10:43 +0000, attemptedRefreshDate: 0001-12-30 00:00:00 +0000, permissions:( status, permission )>}

For Posting

-(void) post:(NSString *)postString {

if (FBSession.activeSession.state == FBSessionStateOpen|| FBSession.activeSession.state == FBSessionStateOpenTokenExtended)
{
    NSArray *permissionsNeeded = @[@"publish_stream"];
    [FBRequestConnection startWithGraphPath:@"/me/permissions"
                          completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
                              if (!error){
                                  NSDictionary *currentPermissions= [(NSArray *)[result data] objectAtIndex:0];
                                  NSMutableArray *requestPermissions = [[NSMutableArray alloc] initWithArray:@[]];
                                  for (NSString *permission in permissionsNeeded){
                                      if (![currentPermissions objectForKey:permission]){
                                          [requestPermissions addObject:permission];
                                      }
                                  }

                                  if ([requestPermissions count] < 1){
                                      [FBSession.activeSession requestNewPublishPermissions:requestPermissions
                                                                            defaultAudience:FBSessionDefaultAudienceFriends
                                                                          completionHandler:^(FBSession *session, NSError *error) {
                                                                              if (!error) {
                                                                                  [self makeRequestToUpdateStatus:postString];
                                                                              } else {
                                                                                  NSLog(@"%@",[error description]);
                                                                              }
                                                                          }];
                                  } else {
                                      [self makeRequestToUpdateStatus:postString];
                                  }

                              } else {

                                   NSLog(@"%@",[error description]);
                              }
                          }];
}
else
{

}

}

For Login

-(void)loginToFacebook { NSLog(@"the facebook login called "); if (!(FBSession.activeSession.state == FBSessionStateOpen || FBSession.activeSession.state == FBSessionStateOpenTokenExtended)){ NSArray *permissions = [[NSArray alloc] initWithObjects: @"publish_stream", nil];

    [FBSession openActiveSessionWithPublishPermissions:permissions defaultAudience:FBSessionDefaultAudienceEveryone allowLoginUI:YES completionHandler:^(FBSession *session, FBSessionState status, NSError *error) {

    dispatch_async( dispatch_get_main_queue(), ^{
        [self sessionStateChanged:session
                            state:status
                            error:error];
         });


    }];
 }

else { }

}

2
Can you post some of your code?Luke Peterson
yes see edited questionuser100

2 Answers

0
votes

Hm, the message indicates you do not request the correct permissions from the user.

Perhaps you requested more before, and therefore it still works with your ABC account, because you 'authorized' the app already with that account at that time. So Facebook still sees that ABC authorized the app to post on the wall.

Edit: added the instructions below in response to your comments:

You can find a list with permissions you can ask for here. Note that with API v 2.0 if you ask for more than a few basic permissions (and posting on a wall is not such a basic permission) you will need to have Facebook 'approve' your app (unless you started your app before April 2014, in which case you can probably keep using v1.0 and not need approval until April 2015).

De-authorizing your own app can be done by logging in as that user, go to settings (menu top right), choose applications at the left and click the 'x' next to your application.

0
votes

Steps

 https://developers.facebook.com/apps
 Select Your App then follow steps.

 in **Settings** -> Basic 
  1. add contact Email
  2. Bundle id
  3. Url Scheme Suffix (like Your app name)

 Then Save

 In **Status & Review**

 1.Do you want to make this app and all its live features available to the general public?
  Set Yes

 May be Useful