アラートが出せない場合
presentした後など、出せない場合のメモ
let alert = UIAlertController(title: "Error", message: "error message", preferredStyle: .alert)
let okAction = UIAlertAction(title: "OK", style: .default, handler: nil)
alert.addAction(okAction)
var baseView = UIApplication.shared.keyWindow?.rootViewController
while ((baseView?.presentedViewController) != nil) {
baseView = baseView?.presentedViewController
}
baseView?.present(alertController, animated: true, completion: nil)