在iPad上直接使用类型为.sheet 的UIAlertController,在presentg的时候会直接crash
解决方案:添加UIalertController的sourceView(表明着歌alert是那个View弹出来的)
swift代码:
if alertVC.popoverPresentationController != nil {
alertVC.popoverPresentationController!.sourceView = self.actionView
alertVC.popoverPresentationController!.sourceRect = self.actionView.bounds
}
self.present(alertVC, animated: true, completion: nil)