我正在开发一个使用解析的Swift iPhone应用程序。 我使用Parse的PFLoginViewController创建了一个简单的登录屏幕。有些弹出窗口(UIAlertControllers)当用户执行诸如没有用户名等注册的事情时,但当登录凭证无效时不会弹出。相反,我只是得到一个错误,在控制台:解析登录错误不会弹出
2015-08-23 22:50:10.246 SwifferApp[24429:1614072] [Error]: invalid login parameters (Code: 101, Version: 1.8.1)
我有当登录失败的功能,但我不能在PFLoginViewController
func logInViewController(logInController: PFLogInViewController, didFailToLogInWithError: NSError?){
var invalidCredentials = UIAlertController(title: "Invalid Credentials", message: "Incorrect username or password.", preferredStyle: UIAlertControllerStyle.Alert)
invalidCredentials.addAction(UIAlertAction(title: "Okay", style: .Default, handler: { (action: UIAlertAction!) in
//do nothing
}))
presentViewController(invalidCredentials, animated: true, completion: nil)
}
呈现UIAlertController在与线“presentViewController”我得到错误
2015-08-23 22:50:10.249 SwifferApp[24429:1613783] Warning: Attempt to present <UIAlertController: 0x7c1f1a50> on <SwifferApp.TimelineTableViewController: 0x7c1b7120> whose view is not in the window hierarchy!
我能做些什么来包括登录错误弹出?
我还是得到了同样的错误:(我知道它不是在窗口层次原因解析登录屏幕是当前存在,但我不知道如何在解析日志屏幕上显示UIAlert –