Hello to everyone and I want to congratulate you on the excellent service. My problem is very simple but it is a couple of days that I can not solve it.
For my application I created this LoginController but I have problem with
backendless.userService.setStayLoggedIn( true )
Every time I start my app, the application does not perform the auto-login and I have to type my user-credentials again. I ’ m reading the doc https://backendless.com/documentation/users/ios/users_login.htm but i could’t find a solution
here’s my code.
thanks
class LoginController : UIViewController {
@IBOutlet weak var emailTextField: UITextField!
@IBOutlet weak var passwordTextField: UITextField!
var backendless = Backendless.sharedInstance()
override func viewDidLoad() {
super.viewDidLoad()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
//StayLogged
func remeberMe(sender: UISwitch) {
backendless.userService.setStayLoggedIn( true )
}
@IBAction func loginUserAsync() {
let email = emailTextField.text
let password = passwordTextField.text
backendless.userService.login(
email, password: password,
response: { ( user : BackendlessUser!) -> () in
print("User has been logged in (ASYNC): \(user)")
//send to LoginView
let viewController:UIViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("MenuTabBar")
//open the view
self.presentViewController(viewController, animated: true, completion: nil)
},
error: { ( fault : Fault!) -> () in
print("Server reported an error: \(fault)")
}
)
}
}