iOS: Initial EasyFB login returns nil user object

Hi

When a user logs into the app for the first time, using easyLoginWithFacebookFieldsMapping, it redirects to Safari, asks the user to grant permission to the app, then redirect back to the app. This all works fine until I call [backendless.userService handleOpenURL:url] which always returns nil.

I get the following error from the SDK, when trying to parse the URL:









UserService -> handleOpenURL: ERROR = Error Domain=NSCocoaErrorDomain Code=3840 "No value for key in object around character 789." UserInfo={NSDebugDescription=No value for key in object around character 789.}

I saw it was an issue with another user, but have been fixed in SDK 3.0.21 (as per link)

Call being done for login:









[backendless.userService easyLoginWithFacebookFieldsMapping:@{@"id":@"username", @"name":@"name"}
                                                    permissions:@[@"email", @"public_profile"]
                                                       response:^(id response) {
                                                           NSLog(@"%@", response);
                                                           [self.hud hide:YES];
                                                       }
                                                          error:^(Fault *fault) {
                                                              NSLog(@"%@", fault.detail);
                                                              [self handleLogInError:fault.];





















                                                          }];

Details of the URL being returned below:

URL: 
backendlessBA6D604B-62A6-4A96-FF25-51317857DA00://%7B%22lastLogin%22:%22Mon%20May%2023%2023:09:28%20UTC%202016%22,%22created%22:%22Mon%20May%2023%2022:45:19%20UTC%202016%22,%22isAdmin%22:false,%22ownerId%22:%22717689B0-4E8F-74AE-FF10-506DA4E1E500%22,%22deviceId%22:null,%22__meta%22:%22%7B%5C%22relationRemovalIds%5C%22:%7B%7D,%5C%22selectedProperties%5C%22:%5B%5C%22created%5C%22,%5C%22isAdmin%5C%22,%5C%22ownerId%5C%22,%5C%22deviceId%5C%22,%5C%22__updated__meta%5C%22,%5C%22password%5C%22,%5C%22twitter_name%5C%22,%5C%22name%5C%22,%5C%22___class%5C%22,%5C%22isTwitter%5C%22,%5C%22profileImageThumbUrl%5C%22,%5C%22profileImageUrl%5C%22,%5C%22updated%5C%22,%5C%22objectId%5C%22,%5C%22email%5C%22,%5C%22username%5C%22%5D,%5C%22relatedObjects%5C%22:%7B%7D%7D%22,%22twitter_name%22:null,%22name%22:%22Niel%20Joubert%22,%22___class%22:%22Users%22,%22isTwitter%22:null,%22user-token%22:%22F2757E6D-43CB-5382-FF3D-A8F126F5FB00%22,%22profileImageThumbUrl%22:null,%22profileImageUrl%22:null,%22updated%22:null,%22objectId%22:%22717689B0-4E8F-74AE-FF10-506DA4E1E500%22,%22email%22:%22nieljoubert@gmail.com%22,%22username%22#_=_

Decoded String: 







backendlessBA6D604B-62A6-4A96-FF25-51317857DA00://{"lastLogin":"Mon May 23 23:09:28 UTC 2016","created":"Mon May 23 22:45:19 UTC 2016","isAdmin":false,"ownerId":"717689B0-4E8F-74AE-FF10-506DA4E1E500","deviceId":null,"__meta":"{\"relationRemovalIds\":{},\"selectedProperties\":[\"created\",\"isAdmin\",\"ownerId\",\"deviceId\",\"__updated__meta\",\"password\",\"twitter_name\",\"name\",\"___class\",\"isTwitter\",\"profileImageThumbUrl\",\"profileImageUrl\",\"updated\",\"objectId\",\"email\",\"username\"],\"relatedObjects\":{}}","twitter_name":null,"name":"Niel Joubert","___class":"Users","isTwitter":null,"user-token":"F2757E6D-43CB-5382-FF3D-A8F126F5FB00","profileImageThumbUrl":null,"profileImageUrl":null,"updated":null,"objectId":"717689B0-4E8F-74AE-FF10-506DA4E1E500","email":"nieljoubert@gmail.com","username"#_=_

Hi Niel,

This problem is associated with your Facebook account. To investigate it we need your Facebook login & password. Could you provide them to support@backendless.com?

Regards,
Vyacheslav Vdovichenko,
Backendless Support Team

Hi

This happens with any Facebook account that is used.

I have emailed my testing profile’s details to support@backendless.com.

Hi Guys

Any ideas when this issue will be sorted as we have a live application up and running and this is not good for business?

Regards

Wayne

We reproduced this issue, now we are working with it, and let your know about a solution.

Internal ticket - BKNDLSS-12553

Niel, Wayne, please try again. Maybe you have some other accounts with this bug - could you send them to support@backendless.com?

Hi

The beginning of the returned URL is not correct now.

Getting the following error:

UserService -> handleOpenURL: ERROR = Error Domain=NSCocoaErrorDomain Code=3840 "No value for key in object around character 12." UserInfo={NSDebugDescription=No value for key in object around character 12.}

For URL:









backendlessba6d604b-62a6-4a96-ff25-51317857da00://{"lastLogin"//graph.facebook.com/v2.5/10154520832965839/picture?type=normal","profileImageUrl":"http://graph.facebook.com/v2.5/10154520832965839/picture?type=large","updated":"Thu May 26 19:20:43 UTC 2016","objectId":"74F6DC77-B3D4-B59D-FFCA-9F3F3A8CFB00","email":"pofmuis69@gmail.com","username":"10154520832965839"}#_=_

Here is my result with your account:
http://support.backendless.com/public/attachments/1ade7bc5ce9f65f519ea3eb4d3303802.png</img>

I just got it with our UserSocial sample from iOS-Samples github. Please check it too, and let me know how it goes for you.

It does return the correct values if the user has been logged in before, but not on the first time the user goes through the process of allowing the FB app access to his account etc.

I can remove the app for my FB user if you can test again. (I removed both Backendless apps from the profile now)

Niel, I do got the bug one time, but now it works fine again! What are you doing with your account to retrieve the bug? Could you describe a scenario?

  1. Delete app from FB user’s account (Settings -> Apps -> delete app)

  2. Open app on phone or simulator

  3. Login using FB

  4. Approve access to profile in browser

  5. Tap ‘Open’ on popup

  6. Returned to app and user will be nil if URL is parsed.

If you log in again, with the same account it will work. Its very weird :frowning:

Thanks, Niel, this indeed can be reproduced.

Hi Guys

Any news on when this will be fixed?

Regards

Wayne

Hi Wayne,

We are still working with this issue, looks like this is a Safari bug.

Regards,
Slava

Thanks for the feedback

@Vyacheslav Seems like the URL being returned does not return the LastLogin value, which then breaks the next key (profileImageURL in our case).

Will logging in via the Facebook SDK route work better, or with the bug be present there as well?

I just checked - login with Facebook SDK works fine (and first and next times)
You could try our FacebookLogin sample .

We have found the solution: if the first request is returned with a broken url, this request is repeated.

To use this feature you should update the latest Backendless SDK from CocoaPods (3.0.24 release) or from ios-SDK github.