[iOS] Warning: UIAlertController is already presenting

Posted in :

UIAlert 彈 2次會出問題,解法:

if presentedViewController == nil {
     self.presentViewController(alertController, animated: true, completion: nil)
} else{
      self.dismissViewControllerAnimated(false) { () -> Void in
           self.presentViewController(alertController, animated: true, completion: nil)
      }
}

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *