HTML5   发布时间:2022-04-27  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了ios – 崩溃日志表明应用程序在我的应用程序中不存在的UIPopoverPresentationController方法崩溃大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我收到崩溃日志,说我的应用程序正在崩溃[UIPopoverPresentationController presentationTransitionWillBegin],但我的@L_197_0@中没有任何地方使用UIPopoverPresentationController.一切都在iPad上,我使用的UIDocumenTinteractionController看起来很相似,也许它是UIPopoverPresentationController的子类,我不知道.知道是什么原因引起的吗?

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000,0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
@R_874_10296@gered by Thread:  0

Last Exception BACktrace:
0   CoreFoundation                  0x184799900 __exceptionPreprocess + 124 (NSException.m:162)
1   libobjc.A.dylib                 0x183e07f80 objc_exception_throw + 56 (objc-exception.mm:531)
2   UIKit                           0x189db43a0 -[UIPopoverPresentationController presentationTransitionWillBegin] + 2884 (UIPopoverPresentationController.m:1197)
3   UIKit                           0x1897e82fc __71-[UIPresentationController _initViewHierarchyForPresentationSuperview:]_block_invoke + 1640 (UIPresentationController.m:1136)
4   UIKit                           0x1897e6414 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke + 332 (UIPresentationController.m:704)
5   UIKit                           0x18973cb70 _runAfterCACommitDeferredBlocks + 292 (UIApplication.m:2312)
6   UIKit                           0x18974a030 _cleanUpAfterCAFlushAndRunDeferredBlocks + 92 (UIApplication.m:2290)
7   UIKit                           0x18947dc24 _afterCACommitHandler + 96 (UIApplication.m:2342)
8   CoreFoundation                  0x184750588 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32 (CFRunLoop.c:1620)
9   CoreFoundation                  0x18474e32c __CFRunLoopDoObservers + 372 (CFRunLoop.c:1716)
10  CoreFoundation                  0x18474e75c __CFRunLoopRun + 928 (CFRunLoop.c:2558)
11  CoreFoundation                  0x18467d680 CFRunLoopRunSpecific + 384 (CFRunLoop.c:2814)
12  Graphicsservices                0x185b8c088 GSEventRunModal + 180 (GSEvent.c:2245)
13  UIKit                           0x1894f4d90 UIApplicationMain + 204 (UIApplication.m:3681)
14  MyCoolApp                       0x100083564 0x10007c000 + 30052
15  libdyld.dylib                   0x18421e8b8 start + 4 (start_glue.s:80)

解决方法

所以问题最终是我有一个UIAlertController,我提出错误的方式.这是导致崩溃的原因.

UIAlertController *alert = [UIAlertController alertControllerWithtitle:NULL message:NULL preferredStyle:UIAlertControllerStyleActionSheet];
[alert addAction:[UIAlertAction actionWithtitle:copyKey style:UIAlertActionStyleDefault handler:alerAction]];
[alert addAction:[UIAlertAction actionWithtitle:shareKey style:UIAlertActionStyleDefault handler:alerAction]];
[alert addAction:[UIAlertAction actionWithtitle:cancelKey style:UIAlertActionStyleCancel handler:alerAction]];

//THIS LINE CRASHED IT
[self presentViewController:alert animated:1 completion:NULL];

我刚刚没有在iPad上进行过充分的测试,当我尝试使用插入的调试器时崩溃并给了我一个冗长的有用信息,这里有一段摘录“你必须通过警报控制器的popoverPresentationController为这个popover提供位置信息” .所以这就是我现在呈现它的方式并且它有效.

[alert setModalPresentationStyle:UIModalPresentationPopover];

UIPopoverPresentationController *popPresenter = [alert popoverPresentationController];
popPresenter.sourceView = self.view;
popPresenter.sourceRect = alertsourceRect;
[self presentViewController:alert animated:YES completion:nil];

大佬总结

以上是大佬教程为你收集整理的ios – 崩溃日志表明应用程序在我的应用程序中不存在的UIPopoverPresentationController方法崩溃全部内容,希望文章能够帮你解决ios – 崩溃日志表明应用程序在我的应用程序中不存在的UIPopoverPresentationController方法崩溃所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。