Andy Andy - 1 year ago 100
iOS Question

Can't login using Facebook Login on iOS 10

I'm having a problem with Facebook login on the latest version of iOS 10 and the latest Facebook SDK using Cocoapods. This was working fine, and now it's not working. When I come back from logging in the access token is nil. It wasn't nil before. I do see a message in my log. I Googled the error and could not find anything. I have followed the instructions in the Facebook developer login guide.

2016-11-04 10:10:26.122435 Ghosts[833:83731] FBSDKLog: Invalid identifier: 'fb_mobile_login_native_app_switch_dialog_result'. Must be between 1 and 40 characters, and must be contain only alphanumerics, _, - or spaces, starting with alphanumeric or _.```

if ([FBSDKAccessToken currentAccessToken]) {

FBSDKCoreKit 4.17.0

iOS 10.1.1

Xcode 8.1

Objective-C with ARC

Answer Source

It turns out that the access token can be nil immediately after. You have to wait for a notification before it can be used. I think this is a new requirement.

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(checkLogIn) name: FBSDKAccessTokenDidChangeNotification object:nil];


That other error message was just a warning I think.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download