Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parse.com Facebook Login stays on "Loading" iOS

I'm using Parse, with the LogInViewController. I added Facebook on the logIn View.

When someone wants to connect with Facebook, it opens the browser, the user accepts the application and then he returns to the app. But when he returns on the app, he stays on "loading" and nothing happens.

However if the user restart the app, it works.

Only when it's the first connexion for the user I have this problem.

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];

    if (![PFUser currentUser]) {        
        // Customize the Log In View Controller
        PFLogInViewController *logInViewController = [[PFLogInViewController alloc] init];
        [logInViewController setDelegate:self];
        [logInViewController setFacebookPermissions:[NSArray arrayWithObjects:@"friends_about_me", nil]];
        [logInViewController setFields:  PFLogInFieldsFacebook | PFLogInFieldsDismissButton];

        // Present Log In View Controller
        [self presentViewController:logInViewController animated:YES completion:NULL];
    }
}

I think the problem isn't in my code because I use the default code of Parse but I'm not sure.

like image 432
saraza Avatar asked Nov 28 '25 18:11

saraza


1 Answers

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
    return [FBAppCall handleOpenURL:url
                  sourceApplication:sourceApplication
                        withSession:[PFFacebookUtils session]];
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
    /*
     Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
     */
    [FBAppCall handleDidBecomeActiveWithSession:[PFFacebookUtils session]];
}

- (void)applicationWillTerminate:(UIApplication *)application {
    /*
     Called when the application is about to terminate.
     Save data if appropriate.
     See also applicationDidEnterBackground:.
     */
    [[PFFacebookUtils session] close];
}
like image 121
Yiu Sing Lee Avatar answered Dec 02 '25 05:12

Yiu Sing Lee



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!