ではないので、私は私が作成したタスクにユーザーを送信します。試みが提示する<UIAlertController:>の<のViewController:>そのビュー私はResearchKitを使用してプロジェクトに取り組んでいますウィンドウ階層
let taskViewController = ORKTaskViewController(task: SurveyTask, taskRunUUID: nil)
taskViewController.delegate = self
presentViewController(taskViewController, animated: true, completion: nil)
私は前に警告を表示しようとすると、私は、問題が発生した。ここ
func taskViewController(taskViewController: ORKTaskViewController, didFinishWithReason reason: ORKTaskViewControllerFinishReason, error: NSError?) {
switch reason {
case .Completed:
... }
:ユーザーは調査を終了したとき、彼はに入りますViewControllerに...:UIAlertControllerを提示する
試み:
taskViewController.dismissViewControllerAnimated(true, completion: nil)
は、私は以下のエラーを取得...そのビューウィンドウ階層
にI方法の任意のアイデアではありませんViewControllerを却下する前にアラートを表示することができますか?
let alertView = UIAlertController(title: "Houps", message: "Could not connect to the server.", preferredStyle: .Alert)
alertView.addAction(UIAlertAction(title: "Ok", style: .Default, handler: nil))
presentViewController(alertView, animated: true, completion: nil)
EDIT::私は警告のために、以下の使用
コードは以下の通りです:
if let httpResponse = response as? NSHTTPURLResponse {
print("HTTP response: \(httpResponse.statusCode)")
if httpResponse.statusCode == 201 {
taskViewController.dismissViewControllerAnimated(true, completion: nil)
}
} else {
print("No HTTP response")
let alertView = UIAlertController(title: "Houps", message: "Could not connect to the server.", preferredStyle: .Alert)
alertView.addAction(UIAlertAction(title: "Ok", style: .Default, handler: nil))
presentViewController(alertView, animated: true, completion: nil)
}
は、あなたの警告コントローラで「OK」ボタンのクリックでビューコントローラを閉じてもらえますか? –
私はまだ解雇したくない、私は最初に警戒して見せたい。解任はうまくいっている。 問題がアラートを表示しています。 – asheyla
はい、@ j.f。アラートに「OK」をタップすると却下すると言っています。 – tktsubota