0
我正在使用Realm移動平臺與我的Realm iOS應用程序,並試圖在用戶登錄後彈出視圖控制器。這是我現在擁有的代碼:登錄Realm移動平臺後的流行視圖控制器
let usernameCredentials = SyncCredentials.usernamePassword(username: emailField.text!, password: passwordField.text!, register: false)
let serverURL = URL(string: "http://45.55.220.254:9080")
SyncUser.logIn(with: usernameCredentials, server: serverURL!){ user, error in
if user != nil{
print("signed in")
MyRealm.copyToSyncedRealm()
self.navigationController?.popToRootViewController(animated: true)
}else if let error = error{
self.loginButton.setTitle("Log in", for: .normal)
let alert = UIAlertController(title: "Error", message: String(describing: error), preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "Ok", style: .default, handler: { void in
}))
self.present(alert, animated: true)
}
}
然而,當我登錄時,視圖控制器沒有彈出,當我點擊導航項目的後退按鈕的應用程序凍結。任何想法爲什麼這可能會發生?