异常处理、程序的崩溃路径捕捉

该文记录了一个iOS应用启动过程中出现的NSInvalidArgumentException异常详细信息,异常发生在尝试向NSArray对象添加元素的操作中,具体涉及UIViewController的viewDidLoad方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

控制面板的输出:
`2016-05-22 17:43:38.972 Exception[1242:39949] -[__NSArray0 addObject:]: unrecognized selector sent to instance 0x7fe8115024f0
2016-05-22 17:43:43.535 Exception[1242:39949] 名字:NSInvalidArgumentException
2016-05-22 17:43:43.535 Exception[1242:39949] 原因:-[__NSArray0 addObject:]: unrecognized selector sent to instance 0x7fe8115024f0
2016-05-22 17:43:43.535 Exception[1242:39949] 用户信息:(null)
2016-05-22 17:43:43.536 Exception[1242:39949] 栈内存地址:(0x105420e4d 0x104e99deb 0x10542948d 0x10537690a 0x1053764b8 0x10499b44c 0x105963f98 0x1059642e7 0x10583aab0 0x10583b199 0x10584cc2e 0x1057c5663 0x1057cbcc6 0x1057c8e7b 0x108199754 0x108199ac2 0x10534ca31 0x10534295c 0x105341e13 0x105341828 0x1057c87cd 0x1057cd610 0x10499bacf 0x107b5c92d)
2016-05-22 17:43:43.536 Exception[1242:39949] 栈描述:(
    0   CoreFoundation                      0x0000000105420e65 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x0000000104e99deb objc_exception_throw + 48
    2   CoreFoundation                      0x000000010542948d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
    3   CoreFoundation                      0x000000010537690a ___forwarding___ + 970
    4   CoreFoundation                      0x00000001053764b8 _CF_forwarding_prep_0 + 120
    5   Exception                           0x000000010499b44c -[ViewController viewDidLoad] + 156
    6   UIKit                               0x0000000105963f98 -[UIViewController loadViewIfRequired] + 1198
    7   UIKit                               0x00000001059642e7 -[UIViewController view] + 27
    8   UIKit                               0x000000010583aab0 -[UIWindow addRootViewControllerViewIfPossible] + 61
    9   UIKit                               0x000000010583b199 -[UIWindow _setHidden:forced:] + 282
    10  UIKit                               0x000000010584cc2e -[UIWindow makeKeyAndVisible] + 42
    11  UIKit                               0x00000001057c5663 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4131
    12  UIKit                               0x00000001057cbcc6 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1760
    13  UIKit                               0x00000001057c8e7b -[UIApplication workspaceDidEndTransaction:] + 188
    14  FrontBoardServices                  0x0000000108199754 -[FBSSerialQueue _performNext] + 192
    15  FrontBoardServices                  0x0000000108199ac2 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
    16  CoreFoundation                      0x000000010534ca31 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    17  CoreFoundation                      0x000000010534295c __CFRunLoopDoSources0 + 556
    18  CoreFoundation                      0x0000000105341e13 __CFRunLoopRun + 867
    19  CoreFoundation                      0x0000000105341828 CFRunLoopRunSpecific + 488
    20  UIKit                               0x00000001057c87cd -[UIApplication _run] + 402
    21  UIKit                               0x00000001057cd610 UIApplicationMain + 171
    22  Exception                           0x000000010499bacf main + 111
    23  libdyld.dylib                       0x0000000107b5c92d start + 1
)
2016-05-22 17:43:43.582 Exception[1242:39949] 系统版本1.0
2016-05-22 17:43:43.582 Exception[1242:39949] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArray0 addObject:]: unrecognized selector sent to instance 0x7fe8115024f0'
*** First throw call stack:
(
    0   CoreFoundation                      0x0000000105420e65 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x0000000104e99deb objc_exception_throw + 48
    2   CoreFoundation                      0x000000010542948d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
    3   CoreFoundation                      0x000000010537690a ___forwarding___ + 970
    4   CoreFoundation                      0x00000001053764b8 _CF_forwarding_prep_0 + 120
    5   Exception                           0x000000010499b44c -[ViewController viewDidLoad] + 156
    6   UIKit                               0x0000000105963f98 -[UIViewController loadViewIfRequired] + 1198
    7   UIKit                               0x00000001059642e7 -[UIViewController view] + 27
    8   UIKit                               0x000000010583aab0 -[UIWindow addRootViewControllerViewIfPossible] + 61
    9   UIKit                               0x000000010583b199 -[UIWindow _setHidden:forced:] + 282
    10  UIKit                               0x000000010584cc2e -[UIWindow makeKeyAndVisible] + 42
    11  UIKit                               0x00000001057c5663 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4131
    12  UIKit                               0x00000001057cbcc6 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1760
    13  UIKit                               0x00000001057c8e7b -[UIApplication workspaceDidEndTransaction:] + 188
    14  FrontBoardServices                  0x0000000108199754 -[FBSSerialQueue _performNext] + 192
    15  FrontBoardServices                  0x0000000108199ac2 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
    16  CoreFoundation                      0x000000010534ca31 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    17  CoreFoundation                      0x000000010534295c __CFRunLoopDoSources0 + 556
    18  CoreFoundation                      0x0000000105341e13 __CFRunLoopRun + 867
    19  CoreFoundation                      0x0000000105341828 CFRunLoopRunSpecific + 488
    20  UIKit                               0x00000001057c87cd -[UIApplication _run] + 402
    21  UIKit                               

转载于:https://www.cnblogs.com/iicecream/p/8404653.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值