现在我收到错误:警告:尝试在 CollectionViewController 上呈现 UIAlertController:0x7f9af9016200:0x7f9af750d620 已经呈现(空)
有没有办法快速堆叠警报?有我的代码,如果项目发布时间超过一天,它会显示警报。我尝试过两种方法但没有成功。
任何解决方案如何管理做到这一点?
for p in json! {
if self.checkDaysPassed(postDate: p["uploadedTime"] as! String) > 1 {
print("more than one day passed, sell item?")
let alert = UIAlertController(title: "Sell this item", message: "This item has been unused for a day", preferredStyle: .alert)
alert.modalPresentationStyle = UIModalPresentationStyle.overCurrentContext
alert.addAction(UIAlertAction(title: "Yes", style: .default){ (action) in
print("pressed yes")
})
alert.addAction(UIAlertAction(title: "No", style: .cancel){ (action) in
print("pressed no")
})
self.present(alert, animated: true)
}
}
Run Code Online (Sandbox Code Playgroud)