Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

exc_bad_access in Facebook sdk login Xcode 8 beta

recently I started adding my application IOS 10 features while I encountered a weird bug:

When authenticating with facebook SDK via browser as soon as I click the confirmation button in facebook itself at the embeded browser, the app crashes.

enter image description here Unfortunately this bug is not informative, the console doesn't tell me anything about it and there is not call stack to see where this exception was occurred.

Two points for demonstrating this bug cause: 1. This bug doesn't occur if the login is via System account but only when it in browser as you can see in the next photo: enter image description here

(As soon as I tap OK the exception occur)

  1. When I am running my app via Xcode 7.x the bug doesn't happen. So it's probably related to the integration of facebook SDK with the new compiler or something like that.

Hope someone has answer for that, or maybe an idea of how can I debug this kind of un informative bug. Thanks in advance, Liran.

like image 557
Liran Revivo Avatar asked Aug 21 '16 22:08

Liran Revivo


1 Answers

I was running into this issue as well. It seems one of the UIApplication Delegate methods was deprecated in iOS 9 and presumably removed in iOS 10.

optional func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool

I replaced it with the following method:

func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
        return FBSDKApplicationDelegate.sharedInstance().application(app,
                                                                     open: url,
                                                                     sourceApplication: options[.sourceApplication] as! String,
                                                                     annotation: options[.annotation])
}
like image 154
adimitri Avatar answered Sep 20 '22 17:09

adimitri