本文介绍了崩溃显示UIPopOverPresentationController的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
***由于未捕获异常NSGenericException而终止应用程序,原因:'UIPopoverPresentationController(< _UIAlertControllerActionSheetRegularPresentationController:0x1a56bd90>)应该在展示之前设置一个非nil sourceView或barButtonItem。'
*** Terminating app due to uncaught exception 'NSGenericException', reason: 'UIPopoverPresentationController (<_UIAlertControllerActionSheetRegularPresentationController: 0x1a56bd90>) should have a non-nil sourceView or barButtonItem set before the presentation occurs.'
推荐答案
我用下面的代码修改并找到了解决方案。
I modified with below code and found solution.
if (DeviceType.IS_IPAD == false)
{
presentViewController(activityVC, animated: true, completion: nil)
}else {
// Change Rect to position Popover
let popUp = UIPopoverController(contentViewController: activityVC)
popUp.presentPopoverFromRect(CGRectZero, inView: self.view, permittedArrowDirections: UIPopoverArrowDirection.Any, animated: true)
}
这篇关于崩溃显示UIPopOverPresentationController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!