iOS- The certificate for this server is invalid.

Hello,
Whenever I try to login or query any data from backendless, I get the following error.
Server reported an error: FAULT = ‘-1202’ [NSURLErrorDomain] <The certificate for this server is invalid. You might be connecting to a server that is pretending to be “api.backendless.com” which could put your confidential information at risk.>
I followed the steps detailed here when I did the set up. https://backendless.com/documentation/users/ios/users_requirements.htm
In my appDelegate

 var backendless = Backendless.sharedInstance()
 backendless.hostURL = "https://api.backendless.com";
 backendless.initApp(BACKENDLESS.APP_ID, secret:BACKENDLESS.SECRET_KEY, version:BACKENDLESS.VERSION_NUM)

and when I try to login in, I get the above error


backendless.userService.login(
 self.emailTextField.text, password:self.passwordTextField.text,
 response: { ( user : BackendlessUser!) -> () in
 print("User has been logged in (ASYNC): \(user)")
 self.isLoggedIn = true
 self.backendless.userService.setStayLoggedIn(true)
 },
 error: { ( fault : Fault!) -> () in
 print("Server reported an error: \(fault)")
 let alert = UIAlertController(title: "Failed to Login", message: fault.detail, preferredStyle: UIAlertControllerStyle.Alert)
 
 alert.addAction(UIAlertAction(title: "Ok", style:
 UIAlertActionStyle.Default, handler: { action in
 }))
 
 self.presentViewController(alert, animated: true, completion: nil)
 }
 )

Thanks

Hi
Please make sure you have data & time set correctly on your device