Facebook logging into wrong app on iOS

0 votes

My iOS app uses Facebook for logging in, however my dev team recently decided to consolidate all our apps into one universal Facebook app with a common APP ID. So I went into my project and tried to change my FacebookAppID and URL Types to the right APP ID, but when I run the app and click on the login button, it redirects me to log into my old app on Facebook. I have absolutely no idea why this is happening, but here is what I have in my AppDelegate file:

/*
 Callback for session changes
*/
- (void)sessionStateChanged:(FBSession *)session
                  state:(FBSessionState) state
                  error:(NSError *)error
{
switch (state) {
    case FBSessionStateOpen:
        if (!error) {
            // We have a valid session
            NSLog(@"User session found");
        }
        break;
    case FBSessionStateClosed:
    case FBSessionStateClosedLoginFailed:
        [FBSession.activeSession closeAndClearTokenInformation];
        break;
    default:
        break;
}

[[NSNotificationCenter defaultCenter]
 postNotificationName:FBSessionStateChangedNotification
 object:session];

if (error) {
    UIAlertView *alertView = [[UIAlertView alloc]
                              initWithTitle:@"Error"
                              message:error.localizedDescription
                              delegate:nil
                              cancelButtonTitle:@"OK"
                              otherButtonTitles:nil];
    [alertView show];
    }
}

/*
 * Opens a Facebook session and optionally shows the login UX.
 */
- (BOOL)openSessionWithAllowLoginUI:(BOOL)allowLoginUI {
    NSArray *permissions = [[NSArray alloc] initWithObjects:
                        @"email",
                        @"user_games_activity",
                        @"user_location",
                        @"user_likes",
                        @"user_birthday",
                        nil];
return [FBSession openActiveSessionWithReadPermissions:permissions
                                          allowLoginUI:allowLoginUI
                                     completionHandler:^(FBSession *session,
                                                         FBSessionState state,
                                                         NSError *error) {
                                         [self sessionStateChanged:session
                                                             state:state
                                                             error:error];
                                     }];
}

/*
 * If we have a valid session at the time of openURL call, we handle
 * Facebook transitions by passing the url argument to handleOpenURL
 */
- (BOOL)application:(UIApplication *)application
        openURL:(NSURL *)url
  sourceApplication:(NSString *)sourceApplication
     annotation:(id)annotation {
    // attempt to extract a token from the url
    return [FBSession.activeSession handleOpenURL:url];
}
/*
 *Logout
 *
 */
- (void) closeSession {
    [FBSession.activeSession closeAndClearTokenInformation];
}

Nov 22 in Mobile Development by gaurav
• 22,040 points
16 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Mobile Development

0 votes
0 answers

Opening Instagram app from a link on iOS

I am providing a feed which is ...READ MORE

Nov 8 in Mobile Development by gaurav
• 22,040 points
52 views
0 votes
0 answers

How facebook measure app installs - Android/IOS

Facebook ads has a feature that it ...READ MORE

Nov 10 in Mobile Development by gaurav
• 22,040 points
25 views
0 votes
0 answers

How to open app from Twitter for iOS WebView on iOS 9

My question pertains to deeplinking from a ...READ MORE

Nov 10 in Mobile Development by gaurav
• 22,040 points
45 views
0 votes
0 answers
0 votes
0 answers

Default Ringtone on a VOIP app in iOS

I'm trying to find a way to ...READ MORE

Nov 16 in Mobile Development by gaurav
• 22,040 points
20 views
0 votes
0 answers

Xamarin iOS: Check if Google fit app is installed on the device

Is there any way to check if ...READ MORE

Nov 17 in Mobile Development by gaurav
• 22,040 points
35 views
0 votes
1 answer

Getting country calling prefix

For a class that offers both this ...READ MORE

answered Sep 20 in Others by Aditya
• 7,660 points
78 views
0 votes
1 answer

white screen on simulator iphone Xcode

After creating the request, you must actually ...READ MORE

answered Sep 20 in Others by Aditya
• 7,660 points
699 views
0 votes
1 answer

Is there a way to to check if a picture was taken on that iPhone?

Actually, the model and manufacturer information is ...READ MORE

answered Sep 22 in IOS by Rahul
• 9,680 points
39 views
0 votes
1 answer

iOS Post to Facebook shows m.facebook.com

From your Feed, tap Search Facebook at ...READ MORE

answered Nov 4 in Others by gaurav
• 22,040 points
50 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP