私はユーザーが最初のalertViewControllerでアクションを選択した後、新しい警告を表示しようとしています。以下の私のコードを見つけてください。前のAlertViewControllerを破棄した後に新しいAlertViewControllerを表示する - Swift
完了コードで書いたコードは実行されないので、2番目のアラートは表示されません。これを解決するために私を助けてください。
私はユーザーが最初のalertViewControllerでアクションを選択した後、新しい警告を表示しようとしています。以下の私のコードを見つけてください。前のAlertViewControllerを破棄した後に新しいAlertViewControllerを表示する - Swift
完了コードで書いたコードは実行されないので、2番目のアラートは表示されません。これを解決するために私を助けてください。
UIAlertViewは、アクションの後でそれ自身を却下するようです。
//3. Grab the value from the text field, and print it when the user clicks OK.
alert.addAction(UIAlertAction(title: "Send", style: .Default, handler: { (action) -> Void in
let textField = alert.textFields![0] as UITextField
guard let email = textField.text else {
return
}
FIRAuth.auth()?.sendPasswordResetWithEmail(email) { error in
if let error = error {
print(error.localizedDescription)
return
}
let alertController = UIAlertController(title: "Email Sent!", message: "Please check you email and follow the password reset instructions", preferredStyle: .Alert)
let action = UIAlertAction(title: "Done", style: .Default, handler: nil)
alertController.addAction(action)
self.presentViewController(alertController, animated: true, completion: nil)
}
}))
完了ハンドラ内でこれを試してください。
dispatch_async(dispatch_get_main_queue()、^ {
})。
完了ハンドラの内部 –
私はこれを試してみましたが、動作しますが、下のような警告が多く表示されます。このアプリケーションは、エンジンの破損や奇妙なクラッシュにつながるバックグラウンドスレッドからAutolayoutエンジンを修正しています。これにより、将来のリリースで例外が発生します。 –
他に何か考えていますか? –