大佬教程收集整理的这篇文章主要介绍了ios – UIAlertController崩溃(iPad),大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
当我使用UIAlertController,它可以在iPhone 6模拟器上运行良好,但在iPad模拟器上崩溃.
这是我的代码:
override func tableView(tableView: UITableView,editActionsForRowATindexPath indexPath: NSIndexPath) -> [AnyObject] { var shareAction = UITableViewRowAction(style: UITableViewRowActionStyle.Default,title: "Share",handler: { (action:UITableViewRowAction!,indexPath:NSIndexPath!) -> Void in let shareMenu = UIAlertController(title: nil,message: "Share using",preferredStyle: .ActionSheet) let twitterAction = UIAlertAction(title: "Twitter",style: UIAlertActionStyle.Default,handler: nil) let facebookAction = UIAlertAction(title: "Facebook",handler: nil) let emailAction = UIAlertAction(title: "Email",handler: nil) let cancelAction = UIAlertAction(title: "Cancel",style: UIAlertActionStyle.Cancel,handler: nil) shareMenu.addAction(twitterAction) shareMenu.addAction(facebookAction) shareMenu.addAction(emailAction) shareMenu.addAction(cancelAction) self.presentViewController(shareMenu,animated: true,completion: nil) } )
Xcode显示此消息:
******TerminaTing app due to uncaught exception 'NSGenericException',reason: 'Your application has presented a UIAlertController (<UIAlertController: 0xaf71c80>) of style UIAlertControllerStyleActionSheet. The modalPresentationStyle of a UIAlertController with this style is UIModalPresentationPopover. You must provide LOCATIOn information for this popover through the alert controller's popoverPresentationController. You must provide either a sourceView and sourceRect or a barButtonItem. If this information is not kNown when you[![enter image description here][1]][1] present the alert controller,you may provide it in the UIPopoverPresentationControllerDelegate method -prepareForPopoverPresentation.' *** First throw call stack: ( 0 CoreFoundation 0x0023c746 __exceptionPreprocess + 182 1 libobjc.A.dylib 0x01c7aa97 objc_exception_throw + 44 2 UIKit 0x012c4062 -[UIPopoverPresentationController presentationTransitionWillBegin] + 3086 3 UIKit 0x00bda174 __71-[UIPresentationController _initViewHierarchyForPresentationSuperview:]_block_invoke + 1549 4 UIKit 0x00bd8247 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke + 198 5 UIKit 0x00c0d31b __40+[UIViewController _scheduleTransition:]_block_invoke + 18 6 UIKit 0x00ac6862 ___afterCACommitHandler_block_invoke + 15 7 UIKit 0x00ac680d _applyBlockToCFArrayCopiedToStack + 415 8 UIKit 0x00ac6622 _afterCACommitHandler + 549 9 CoreFoundation 0x0015d86e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30 10 CoreFoundation 0x0015d7b0 __CFRunLoopDoObservers + 400 11 CoreFoundation 0x001531ea __CFRunLoopRun + 1226 12 CoreFoundation 0x00152a5b CFRunLoopRunSpecific + 443 13 CoreFoundation 0x0015288b CFRunLoopRunInMode + 123 14 Graphicsservices 0x047b82c9 GSEventRunModal + 192 15 Graphicsservices 0x047b8106 GSEventRun + 104 16 UIKit 0x00a9c106 UIApplicationMain + 1526 17 Mars I 0x0001c724 main + 180 18 libdyld.dylib 0x02392ac9 start + 1 19 ??? 0x00000001 0x0 + 1 ) libc++abi.dylib: terminaTing with uncaught exception of type NSException******
以上是大佬教程为你收集整理的ios – UIAlertController崩溃(iPad)全部内容,希望文章能够帮你解决ios – UIAlertController崩溃(iPad)所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。