gpt4 book ai didi

ios - 特定 Segue 处的 NSRangeException

转载 作者:行者123 更新时间:2023-11-30 14:04:15 24 4
gpt4 key购买 nike

我有一个特殊的segue,它不断地给我NSRangeException。我在prepareForSegue 中根本没有代码。我在该 View Controller 的 viewdidload 中放置了一个断点,它的执行没有问题。看来异常发生在IOS系统代码中。

这是异常的详细信息

2015-09-16 07:21:24.939 Vote Strategic[7523:1117149] * Terminating app due to uncaught exception 'NSRangeException', reason: '* -[NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array' *** First throw call stack: ( 0 CoreFoundation 0x000000010a699c65 __exceptionPreprocess + 165 1 libobjc.A.dylib 0x000000010c204bb7 objc_exception_throw + 45 2 CoreFoundation 0x000000010a583093 -[__NSArrayM objectAtIndex:] + 227 3 My Strategic 0x000000010a008cfa _TPAo13 + 42 4 My Strategic 0x000000010a009c35 _TTRXFo_dSi_aPSs9AnyObject__XFo_dSi_oPS_ + 21 5 My Strategic 0x000000010a0094ec _TFFC14My_Strategic4Rest9getRidingFS0_FSST_U_FTGSQCSo13NSURLResponse_GSQCSo6NSData_GSQCSo7NSError__T_ + 1260 6 My Strategic 0x000000010a009cea _TTRXFo_oGSQCSo13NSURLResponse_oGSQCSo6NSData_oGSQCSo7NSError__dT__XFdCb_dGSQS__dGSQS0__dGSQS1___dT__ + 90 7 CFNetwork 0x000000010c8a98c5 67+[NSURLConnection sendAsynchronousRequest:queue:completionHandler:]_block_invoke_2 + 155 8 Foundation 0x000000010ab5a57f __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK + 7 9 Foundation 0x000000010aa9b0b2 -[NSBlockOperation main] + 98 10 Foundation 0x000000010aa7d774 -[__NSOperationInternal _start:] + 645 11 Foundation 0x000000010aa7d383 __NSOQSchedule_f + 184 12 libdispatch.dylib 0x000000010dcfe614 _dispatch_client_callout + 8 13 libdispatch.dylib 0x000000010dce56a7 _dispatch_queue_drain + 2176 14 libdispatch.dylib 0x000000010dce4cc0 _dispatch_queue_invoke + 235 15 libdispatch.dylib 0x000000010dce83b9 _dispatch_root_queue_drain + 1359 16 libdispatch.dylib 0x000000010dce9b17 _dispatch_worker_thread3 + 111 17 libsystem_pthread.dylib 0x000000010e06b637 _pthread_wqthread + 729 18 libsystem_pthread.dylib 0x000000010e06940d start_wqthread + 13 ) libc++abi.dylib: terminating with uncaught exception of type NSException

最佳答案

请放置异常断点并在 Debug模式下运行,以便在崩溃的确切行处停止。

显然,您正在尝试从空数组访问对象,这必然会崩溃。始终建议在访问数组元素之前检查数组大小。

enter image description here

关于ios - 特定 Segue 处的 NSRangeException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32607388/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com