Facebook request profile Graph API not working on iOS 7 native facebook non logged in

So I ran into something I can't explain. I've got two devices

  1. Iphone 4 Running iOS 7.0.6. With Native Facebook app installed. But not logged in
  2. iPhone 5s Running iOS 7.1. With Native Facebook app installed and user logged in.

When I try to access the profile data. It's running smoothly on an iPhone 5s, but breaks after permission dialog on the iPhone 4. So the user allows for sharing specific info to the app. Then at a next screen I'm confronted with a general error message (in Facebook app), saying it was unable to process.

This is how I got it working so far.

Facebook permission

// Make request facebook
    [FBSession openActiveSessionWithReadPermissions:[NSArray arrayWithObjects:@"email", nil]
                                       allowLoginUI:YES
                                  completionHandler:^(FBSession *session, FBSessionState status, NSError *error)
     {
         if (error)
         {

             NSLog(@"Facebook Errors: %@", error.description);
             UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Facebook unable to connect"
                                                             message:@"Facebook error message here"
                                                            delegate:nil
                                                   cancelButtonTitle:@"OK"
                                                   otherButtonTitles:nil];
             [alert show];
             [alert release];



         }
         if (FBSession.activeSession.isOpen)
         {
             // Login via Facebook succeeded.
             // We have a session.
             [self facebookLoginRequestForMe:onCompletion withScore:score];
         }
         else
         {
             // We could not login to Facebook.
             if (onCompletion)
             {

                 onCompletion(false);
             }
         }
     }];

Trying to access profile

[[FBRequest requestForMe] startWithCompletionHandler:^(FBRequestConnection *connection, NSDictionary<FBGraphUser>* fbUser, NSError *fbError)
 {
     NSString* fbUserEmail = [fbUser objectForKey:@"email"];
     bool fbSuccess = (!fbError && fbUserEmail && fbUserEmail.length > 0);

     if (fbSuccess)
     {
         NSString* facebookImageURL = [NSString stringWithFormat:@"http://graph.facebook.com/%@/picture?type=large", fbUser.id];

         NSLog(@"User name: %@", fbUser.name);
         NSLog(@"User email: %@", fbUserEmail);
         NSLog(@"usr_id: %@", fbUser.id);
         NSLog(@"usr_first_name: %@", fbUser.first_name);
         NSLog(@"usr_middle_name: %@", fbUser.middle_name);
         NSLog(@"usr_last_name: %@", fbUser.last_name);
         NSLog(@"usr_username: %@", fbUser.username);
         NSLog(@"usr_birthday: %@", fbUser.birthday);
         NSLog(@"avatar url: %@", facebookImageURL);


     }
     else if (onCompletion)
     {
         onCompletion(false);
         //TODO: present custom error
     }

Am I missing some special callback data I need to present?

Thanks!

Answers


Don't believe this! But got it resolved

Scenario: if you have not signed in on Facebook natively (settings -> Facebook -> login credentials here), your device will use the Facebook app to validate the authorization for profile data via Facebook.

This will not work if you have not put the Facebook app in Live mode.

  1. Go to developer.facebook.com
  2. Go to apps
  3. Select Status / review
  4. Do you want to make this app and all its live features available to the general public? YES

You're done!


Need Your Help

MsgBox appears multiple times after data is pulled from a sheet

excel vba excel-vba messagebox msgbox

I'd like to get some help with the following code. I am very new to this but I think it's an easy solution I'm just unable to retrofit suggestions from other searches into my code.

SQL syntax error with joins

sql oracle join

Can someone point our what is wrong with below query? I have 3 tables.