2015-12-11 80 views
4

我收到崩潰日誌,說我的應用崩潰在[UIPopoverPresentationController presentationTransitionWillBegin],但在我的代碼中無處使用UIPopoverPresentationController。這一切都在iPad上,我使用的UIDocumentInteractionController看起來很相似,也許它是UIPopoverPresentationController的一個子類,我不知道。任何想法可能會造成這種情況?崩潰日誌表明應用程序崩潰UIPopoverPresentationController方法不存在於我的應用程序

Exception Type: EXC_CRASH (SIGABRT) 
Exception Codes: 0x0000000000000000, 0x0000000000000000 
Exception Note: EXC_CORPSE_NOTIFY 
Triggered 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) 
+0

這與iPhone 6s設備上的3D觸摸有關。真是不幸,因爲據我所知,沒有辦法阻止它發生。我從Fabric.io中獲取類似的報告來獲取我的應用程序。 – brandonscript

+0

我只在iPad上收到它。你的用戶告訴你什麼? – dave234

+0

是的,抱歉應該澄清 - 它與3D觸摸事件無關,它與處理3D觸摸的iOS 9代碼有關。沒有任何用戶的細節,但不幸的是。 – brandonscript

回答

3

所以問題結果是我有一個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彈出「。所以這就是我現在如何展示它,它的工作原理。

[alert setModalPresentationStyle:UIModalPresentationPopover]; 

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