Easy facebook login, user = nil first time

Hi,
I am also expericencing a weired behaviour. When i am trying login with facebook first time.
At sometime openUrl method in appdelegate, I got backendless userobject which is nil.
My code example:

 func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool
 {
 print("AppDelegate -> application:openURL: \(url.scheme)")
 let backendless = Backendless.sharedInstance()
 let dataObj = backendless.userService.handleOpenURL(url)
 
 if dataObj != nil
 {
 let valid = dataObj.isKindOfClass(NSError)
 if !valid
 {
 let user = dataObj as? BackendlessUser
 if user != nil
 {
 print("AppDelegate -> application:openURL: user = \(user)")
 backendless.userService.setStayLoggedIn(true)
 backendless.userService.currentUser = user
 // do something, call some ViewController method, for example)
 loginViewController?.dismissViewControllerAnimated(true, completion: nil)
 loginViewController = nil
 
 }
 else
 {
 print("AppDelegate -> application:openURL: user = \(user)")
 UIAlertController.showAlertOfStyle(.Alert, Message: "Something went wrong, Please try again", Delegate: nil)
 }
 }
 }
 else
 {
 UIAlertController.showAlertOfStyle(.Alert, Message: "Something went wrong, Please try again", Delegate: nil)
 }
 return true
 }

Scenario :

  1. I am not loggedin at facebbook.
  2. I started easy login.
  3. I redirected to facebook page.
  4. i entered my credentials.
  5. i accept the app requirement.
  6. It redirects to api.backendless.com.
  7. Appdelegate openUrl method called.
  8. i have attached response data and url as screenshot.
    It only happens when i am not logged in at facebook page.

It seems that “objectId” property is the URL does not have a value, right?
Also, according to your words:

It only happens when i am not logged in at facebook page.

does it mean that in the anonymous browser tab it will be reproduced constantly?

Yes, it is repoducing consistently if i goes with given scenario.

I am using safari browser and tested with iPhone 6P and iPhone 5.

Could you please provide a minimal application, which we could just run and reproduce the error?

A cause of this issue is a bug in Safari. We have found the solution, you should update the latest Backendless SDK via CocoaPods (3.0.27 release) or from ios-SDK github (CommLibiOS and backendless).
Also you could investigate our UserSocial sample, it shows the calls to Facebook, Twitter and Google.

Hi,

Me also getting the same issue, getting nil (let user = backendless.userService.handleOpenURL(url)) for first time facebook login

How i can solve this issue

Thanks & Regards,
Fevicks.V

Hi Fevicks,

did you update the iOS SDK?

Stanislaw

Hi Stanislav,

Now i updated the sdk to 3.0.30, Now i can get the user object, But i am getting the below log

2016-07-25 16:20:03.675 SariSocial[21442:654779] 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.}

Fevicks, you should update to 3.0.32