我遇到了以下堆栈跟踪崩溃:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason:Expected a popover view, found (null)
Last Exception Backtrace:
0 CoreFoundation ___exceptionPreprocess (in CoreFoundation) 176
1 libobjc.A.dylib objc::DenseMap<DisguisedPtr<objc_object>, objc::DenseMap<void const*, objc::ObjcAssociation, objc::DenseMapValueInfo<objc::ObjcAssociation>, objc::DenseMapInfo<void const*>, objc::detail::DenseMapPair<void const*, objc::ObjcAssociation>>, objc::DenseMapValueInfo<objc::DenseMap<void const*, objc::ObjcAssociation, objc::DenseMapValueInfo<objc::ObjcAssociation>, objc::DenseMapInfo<void const*>, objc::detail::DenseMapPair<void const*, objc::ObjcAssociation>>>, objc::DenseMapInfo<DisguisedPtr<objc_object>>, obj (in libobjc.A.dylib) 451
2 Foundation -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] (in Foundation) 187
3 UIKitCore -[_UIModernPopoverAnimationController animateTransition:] (in UIKitCore) 1575
4 UIKitCore ____UIViewControllerTransitioningRunCustomTransition_block_invoke_3 (in UIKitCore) 51
5 UIKitCore +[UIKeyboardSceneDelegate _pinInputViewsForKeyboardSceneDelegate:onBehalfOfResponder:duringBlock:] (in UIKitCore) 95
6 UIKitCore ____UIViewControllerTransitioningRunCustomTransition_block_invoke_2 (in UIKitCore) 195
7 UIKitCore +[UIView(Animation) _setAlongsideAnimations:toRunByEndOfBlock:] (in UIKitCore) 179
8 UIKitCore __UIViewControllerTransitioningRunCustomTransition (in UIKitCore) 483
9 UIKitCore ___56-[UIPresentationController runTransitionForCurrentState]_block_invoke_3 (in UIKitCore) 1583
10 UIKitCore -[_UIAfterCACommitBlock run] (in UIKitCore) 71
11 UIKitCore -[_UIAfterCACommitQueue flush] (in UIKitCore) 163
12 libdispatch.dylib __dispatch_call_block_and_release (in libdispatch.dylib) 31
13 libdispatch.dylib __dispatch_client_callout (in libdispatch.dylib) 19
14 libdispatch.dylib __dispatch_main_queue_drain (in libdispatch.dylib) 987
15 libdispatch.dylib __dispatch_runloop_queue_handle_dispose (in libdispatch.dylib) 1891
16 CoreFoundation ___CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ (in CoreFoundation) 15
17 CoreFoundation ___CFRunLoopRun (in CoreFoundation) 1995
18 CoreFoundation -[NSDictionary enumerateKeysAndObjectsUsingBlock:] (in CoreFoundation) 1123
19 GraphicsServices ___GSKeyboardClassInitialize (in GraphicsServices) 203
20 UIKitCore -[UIApplication _run] (in UIKitCore) 887
21 UIKitCore -[UICollectionView _reconfigureCell:forItemAtIndexPath:] (in UIKitCore) 1431
22 AppName main (in AppName) (main.m:20) 55
23 dyld 0x00000001ae4a5e4c 71846EAC-EE65-3697-BF7D-790B6A07DCDB + 249420
Thread 0 Crashed:
0 AppName _UncaughtExceptionHandler (in AppName) (BDPanSecurityGuiderManager+IgnoringCrash.m:19) 12
1 AppName _bd_ad_handle_exception(NSException*) (in AppName) 84
2 CoreFoundation ___handleUncaughtException (in CoreFoundation) 660
3 libobjc.A.dylib _objc_terminate() (in libobjc.A.dylib) 132
4 AppName hmdBU_cpp_terminate_handle() (in AppName) (HMDBUCrashDetectCPP.mm:118) 4
5 libc++abi.dylib std::__terminate(void (*)()) (in libc++abi.dylib) 16
6 libc++abi.dylib __cxxabiv1::(anonymous namespace)::InitByteGlobalMutex<__cxxabiv1::(anonymous namespace)::LibcppMutex, __cxxabiv1::(anonymous namespace)::LibcppCondVar, __cxxabiv1::(anonymous namespace)::GlobalStatic<__cxxabiv1::(anonymous namespace)::LibcppMutex>::instance, __cxxabiv1::(anonymous namespace)::GlobalStatic<__cxxabiv1::(anonymous namespace)::LibcppCondVar>::instance, &__cxxabiv1::(anonymous namespace)::PlatformThreadID()>::LockGuard::~LockGuard() (in libc++abi.dylib) 212
7 libdispatch.dylib __dispatch_client_callout (in libdispatch.dylib) 40
8 libdispatch.dylib __dispatch_main_queue_drain (in libdispatch.dylib) 988
9 libdispatch.dylib __dispatch_runloop_queue_handle_dispose (in libdispatch.dylib) 1892
10 CoreFoundation ___CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ (in CoreFoundation) 16
11 CoreFoundation ___CFRunLoopRun (in CoreFoundation) 1996
12 CoreFoundation -[NSDictionary enumerateKeysAndObjectsUsingBlock:] (in CoreFoundation) 1124
13 GraphicsServices ___GSKeyboardClassInitialize (in GraphicsServices) 204
14 UIKitCore -[UIApplication _run] (in UIKitCore) 888
15 UIKitCore -[UICollectionView _reconfigureCell:forItemAtIndexPath:] (in UIKitCore) 1432
16 AppName main (in AppName) (main.m:20) 56
17 0x0000000000000000 0x1ae4a5e4c 0x0 + 7219076684
此信息没有明确的堆栈跟踪,因此我不知道崩溃的原因是什么。我想到的相关代码如下,不过好像没有太大问题
+ (void)openFileShareExtensionWithURL:(NSURL *)url
navigationController:(UIViewController *)vc {
FileOpenHelper *helper = [[FileOpenHelper alloc] init];
docInteractionController = [UIDocumentInteractionController interactionControllerWithURL:url];
docInteractionController.delegate = helper;
CGRect frame;
if ([UIDevice currentDevice].isiPad) {
frame = CGRectMake(CGRectGetWidth(vc.view.frame) / 2.0, [BHStyles topNavInsetHeight] + 10, 0, 0);
} else {
frame = vc.view.bounds;
}
BOOL r = [docInteractionController presentOptionsMenuFromRect:frame
inView:vc.view
animated:YES];
if (!r) {
[SVProgressHUD showErrorWithStatus:NSLocalizedString(@"Storage_NoSupport", nil) duration:1.5f];
}
}
我尝试重现,但没有成功。
这个崩溃似乎是由于在枚举过程中修改字典引起的。检查您的相关代码并使用
for-loop
代替。