2

I'm testing an app with facebook login . I made a button and when i click it Facebook pages appears and after the password it disappears. The problem is that the block from [PFFacebookUtils loginWithPermissions] is never called. That way i can't preform my segue.

I think i have all the configurations made on Parse and Facebook. All classes are imported in the PrefixHeader

The Appdelegate methods have been updated with the info that is in the docs of developer.facebook.com.

PrefixHeader PrefixHeader

AppDelegate AppDelegate

My Root View Controller Class AppDelegate

LuisFOSoares
  • 107
  • 8

2 Answers2

7

After a lot of hours i figured it out !

I don't know why but i needed to change the AppDelegate code to

 - (BOOL)application:(UIApplication *)application
        openURL:(NSURL *)url
        sourceApplication:(NSString *)sourceApplication
        annotation:(id)annotation {
        // attempt to extract a token from the url
     return [FBAppCall handleOpenURL:url sourceApplication:sourceApplication withSession:[PFFacebookUtils session]];

}

and not the block is now called because i added "withSession:[PFFacebookUtils session]" .

I have no idea why i have to do this because in the Facebook guide it's not written. If someone could explain me i would be thankful.

LuisFOSoares
  • 107
  • 8
  • Worked for me too. Parse tell to do this in its documentation : https://www.parse.com/docs/ios_guide#fbusers/iOS They also say you should add [FBAppEvents activateApp]; in applicationDidBecomeActive – CedricSoubrie Apr 30 '15 at 15:28
2

For those of you stuck on Swift 1.x, this solved my problem...the current parse-ios-fb guide says to use

func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject?) -> Bool {
    println("open URL appdelgate callback")
    return FBSDKApplicationDelegate.sharedInstance().application(application,
        openURL: url,
        sourceApplication: sourceApplication,
        annotation: annotation)
}

but doing

func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject?) -> Bool {
    return FBAppCall.handleOpenURL(url, sourceApplication: sourceApplication, withSession:PFFacebookUtils.session())
}

works. Swift 1.2, Parse/ParseFacebookUtils 1.8.5, Facebook 4.3