LuisFOSoares
LuisFOSoares

Reputation: 107

PFFacebookUtils loginWithPermissions block never called

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

Upvotes: 2

Views: 1232

Answers (2)

user2044555
user2044555

Reputation: 29

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

Upvotes: 2

LuisFOSoares
LuisFOSoares

Reputation: 107

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.

Upvotes: 7

Related Questions