Xcode 7 找不到有关哪一行或哪个方法崩溃的详细信息



如何识别应用程序崩溃的地方。我试过添加所有异常断点。我试着搜索rangeOfCharacterFromSet,但没有真正崩溃的地方。

2016-10-13 15:18:29.809 Dev[11794:809091] -[NSNull rangeOfCharacterFromSet:]: unrecognized selector sent to instance 0x5dae398
2016-10-13 15:18:29.816 Dev[11794:809091] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull rangeOfCharacterFromSet:]: unrecognized selector sent to instance 0x5dae398'
*** First throw call stack:
(
    0   CoreFoundation                      0x05b81494 __exceptionPreprocess + 180
    1   libobjc.A.dylib                     0x0563be02 objc_exception_throw + 50
    2   CoreFoundation                      0x05b8b253 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
    3   CoreFoundation                      0x05ac089d ___forwarding___ + 1037
    4   CoreFoundation                      0x05ac046e _CF_forwarding_prep_0 + 14
    5   UIKit                               0x0357acc6 -[UILabel _contentInsetsFromFonts] + 147
    6   UIKit                               0x03907ecc -[_UILabelLayer updateContentInsets] + 131
    7   UIKit                               0x03907fa1 -[_UILabelLayer updateContentLayerSize] + 48
    8   UIKit                               0x03908158 -[_UILabelLayer layoutSublayers] + 35
    9   QuartzCore                          0x030398b6 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 388
    10  QuartzCore                          0x030485b0 -[CALayer(CALayerPrivate) layoutBelowIfNeeded] + 44
    11  UIKit                               0x03377ba4 -[UIView(Hierarchy) layoutBelowIfNeeded] + 1258
    12  UIKit                               0x036aaa48 -[UITableViewCell _setFrame:skipLayout:] + 420
    13  UIKit                               0x036aa89f -[UITableViewCell setFrame:] + 63
    14  UIKit                               0x0343998d __53-[UITableView _configureCellForDisplay:forIndexPath:]_block_invoke + 4094
    15  UIKit                               0x0337ddb2 +[UIView(Animation) performWithoutAnimation:] + 82
    16  UIKit                               0x0337ddfb +[UIView(Animation) _performWithoutAnimation:] + 40
    17  UIKit                               0x0343897c -[UITableView _configureCellForDisplay:forIndexPath:] + 504
    18  UIKit                               0x0344596b -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 877
    19  UIKit                               0x03445a7d -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 90
    20  UIKit                               0x03415b32 -[UITableView _updateVisibleCellsNow:isRecursive:] + 3347
    21  UIKit                               0x03434416 __29-[UITableView layoutSubviews]_block_invoke + 52
    22  UIKit                               0x0344f6cc -[UITableView _performWithCachedTraitCollection:] + 88
    23  UIKit                               0x034342eb -[UITableView layoutSubviews] + 214
    24  UIKit                               0x0338a3d4 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 810
    25  libobjc.A.dylib                     0x05650059 -[NSObject performSelector:withObject:] + 70
    26  QuartzCore                          0x03046096 -[CALayer layoutSublayers] + 144
    27  QuartzCore                          0x030398b6 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 388
    28  QuartzCore                          0x0303971a _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26
    29  QuartzCore                          0x0302bee7 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 317
    30  QuartzCore                          0x03060847 _ZN2CA11Transaction6commitEv + 561
    31  QuartzCore                          0x03061108 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
    32  CoreFoundation                      0x05a9375e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
    33  CoreFoundation                      0x05a936be __CFRunLoopDoObservers + 398
    34  CoreFoundation                      0x05a8903c __CFRunLoopRun + 1340
    35  CoreFoundation                      0x05a88846 CFRunLoopRunSpecific + 470
    36  CoreFoundation                      0x05a8865b CFRunLoopRunInMode + 123
    37  GraphicsServices                    0x07149664 GSEventRunModal + 192
    38  GraphicsServices                    0x071494a1 GSEventRun + 104
    39  UIKit                               0x032b9eb9 UIApplicationMain + 160
    40  Dev                           0x0015aaca main + 138
    41  libdyld.dylib                       0x06067a25 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

Xcode不显示一行代码,因为你的代码没有在堆栈跟踪中。所有的框架都在系统框架中(除了main())。当您将坏数据传递给系统框架时,无论出于何种原因,都会发生这种情况,在这种情况下,通过将坏数据传递给UILabel—可能将NSNull实例作为标签的标题。这通常是由于JSON解析出错而发生的(但也可能由于各种其他原因发生)。

你需要加强你的数据处理代码,防止意外的值或意外的结构。

最新更新