XCode:ios 9-10 vs ios 11上类型NSException的未捕获异常

时间:2018-01-02 20:56:49

标签: ios xcode ios11

我注意到一些例外,例如NSGenericException或NSManagedObject Exceptions在iOS 11上的应用崩溃时输出中不包含很多细节。但是如果我在iOS 9或10上运行并使其崩溃,那么同时将包含许多有用的细节。

例如。同样的应用程序,同样的崩溃,在iOS 11上:

libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

在iOS 9-10上:

2018-01-02 23:51:22.967 CafeManager[3726:130232] *** Terminating app due to uncaught exception 'NSGenericException', reason: 'Your application has presented a UIAlertController (<UIAlertController: 0x7f959a7634c0>) 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 present the alert controller, you may provide it in the UIPopoverPresentationControllerDelegate method -prepareForPopoverPresentation.'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010f61eb0b __exceptionPreprocess + 171
    1   libobjc.A.dylib                     0x000000010ec6f141 objc_exception_throw + 48
    2   UIKit                               0x0000000110c04d67 -[UIPopoverPresentationController presentationTransitionWillBegin] + 3291
    3   UIKit                               0x00000001102ac3c2 __71-[UIPresentationController _initViewHierarchyForPresentationSuperview:]_block_invoke + 2278
    4   UIKit                               0x00000001102a9d20 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke + 426
    5   UIKit                               0x0000000110137853 _runAfterCACommitDeferredBlocks + 318
    6   UIKit                               0x000000011012481c _cleanUpAfterCAFlushAndRunDeferredBlocks + 532
    7   UIKit                               0x0000000110156560 _afterCACommitHandler + 137
    8   CoreFoundation                      0x000000010f5c4717 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
    9   CoreFoundation                      0x000000010f5c4687 __CFRunLoopDoObservers + 391
    10  CoreFoundation                      0x000000010f5a9720 __CFRunLoopRun + 1200
    11  CoreFoundation                      0x000000010f5a9016 CFRunLoopRunSpecific + 406
    12  GraphicsServices                    0x0000000114cc1a24 GSEventRunModal + 62
    13  UIKit                               0x000000011012b134 UIApplicationMain + 159
    14  CafeManager                         0x000000010dd37747 main + 55
    15  libdyld.dylib                       0x0000000113d1c65d start + 1
    16  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

正如你所看到的,它确实有所不同。我错过了什么?任何调试器设置还是与iOS 11相关的问题?

更新: 在Apple Developer论坛和Apple Bug记者上提出了同样的问题。到目前为止还没有答案。

1 个答案:

答案 0 :(得分:2)

您是否有机会设置OS_ACTIVITY_MODE变量?

要检查是否设置了此变量(并将其关闭),请在Xcode 9中执行以下操作:

从Xcode菜单中选择产品 - &gt;方案 - &gt;编辑方案.. 选择Run方案并在Arguments下查看。 如果您看到OS_ACTIVITY_MODE变量已选中,请取消选择它。