Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 450
LuisFOSoares Avatar asked Dec 04 '25 13:12

LuisFOSoares


2 Answers

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.

like image 111
LuisFOSoares Avatar answered Dec 10 '25 14:12

LuisFOSoares


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

like image 34
user2044555 Avatar answered Dec 10 '25 14:12

user2044555



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!