Warning: UIAlertController is already presenting

You need to change your code like this, present the second alertController on completion of dismiss. Also change your if condition with my one.

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

Hope this will help you.


Try this

if let presented = self.presentedViewController {
     presented.removeFromParentViewController()
  }

if presentedViewController == nil {
     self.present(alert, animated: true, completion: nil)
  }