0
UIAlertControllerにエラーメッセージを表示する可能性があるのだろうかと思います。swift show UIAlertControllerのエラーメッセージの配列
私のサーバーはJSONとしてエラーメッセージを返します。
私が使用して各エラーメッセージを取得することができます。
if let errorVal = errorVal {
if let items = errorVal["errors"].array {
for item in items {
print(item)
}
}
}
今、私は私がAlertControllerでエラーを表示することができますか疑問。 AlertControllerのメッセージパラメータは、文字列を期待していますが、私のエラーは、JSONはその後、さて、あなたはそれぞれのエラー(または単にメッセージ)の説明を文字列を構築することができ
let alertController = UIAlertController(title: "Hey! :)", message: "My Errors", preferredStyle: .Alert)
let defaultAction = UIAlertAction(title: "OK", style: .Default, handler: nil)
alertController.addAction(defaultAction)
self.presentViewController(alertController, animated: true, completion: nil)