Fault handling user login

Hi Guys I have this block, this works for most faults (like incorrect passwords, null usernames etc etc) However I was testing logging in with no connection (actually I put it in Flight mode) and it crashes the app with Could not cast value of type ‘NSException’ (0x1f8cfe0b0) to 'Fault’

I want to get the fault code, intercept it with a custom message.

Can you help with the following code block to get the fault if no connection?

Types.tryblock({ () -> Void in
            let user = self.backendless?.userService.login(email, password: password)
  },
  catchblock: { (exception) -> Void in
                  let myFault = exception as! Fault
  })

Many thanks,

Mike

Hello,
I highly recommend you to use the async method:

Backendless.sharedInstance()?.userService.login("email", password: "password", response: { user in
}, error: { fault in
    print("Error: \(fault?.message)")
})

For the sync method the fix was made and the newest version of iOS-SDK will be available on Monday.

Regards,
Olha

Thanks Olha!

confirm that the new version of SDK fixed this. Thankyou