简体   繁体   English

NSRangeException在特定Segue

[英]NSRangeException at particular Segue

I have this particular segue that keeps giving me NSRangeException. 我有这种特殊的选择,一直给我NSRangeException。 I have no code at all in prepareForSegue. 我在prepareForSegue中根本没有任何代码。 I put a break point in viewdidload of that view controller and it is executed with no problem. 我在该视图控制器的viewdidload中设置了一个断点,并且执行起来没有问题。 Seems that the exception occurs in IOS system code. 似乎该异常发生在IOS系统代码中。

This is detail of exception 这是例外的细节

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 __NSBLOCKOP 2015-09-16 07:21:24.939投票Strategic [7523:1117149] *由于未捕获的异常'NSRangeException'而终止应用程序,原因:'* -[ NSArrayM objectAtIndex:]:索引0超出了空数组的范围'***第一个引发调用堆栈:(0 CoreFoundation 0x000000010a699c65 __exceptionPreprocess + 165 1 libobjc.A.dylib 0x000000010c204bb7 objc_exception_throw + 45 2 CoreFoundation 0x000000010a583093-[__ NSArrayM objectAtIndex:] + 227 3 My Strategic 0x000000010a008__PSAd_PSAd_PSAd_PSn_PSAd_PSn_PSAd_PSn_PSAd_PSn_PSAd_PSn_PS_PSA_D5 0x000000010A008c_ _TPAo_3 0x000000010a0094ec _TFFC14My_Strategic4Rest9getRidingFS0_FSST_U_FTGSQCSo13NSURLResponse_GSQCSo6NSData_GSQCSo7NSError__T_ + 1260 6我的战略0x000000010a009cea _TTRXFo_oGSQCSo13NSURLResponse_oGSQCSo6NSData_oGSQCSo7NSError__dT__XFdCb_dGSQS__dGSQS0__dGSQS1___dT__ + 90 7 CFNetwork的0x000000010c8a98c5 67+ [NSURLConnection的sendAsynchronousRequest:队列:completionHandler:] _ block_invoke_2 + 155 8基金会0x000000010ab5a57f __NSBLOCKOP ERATION_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 ERATION_IS_CALLING_OUT_TO_A_BLOCK + 7 9基金会0x000000010aa9b0b2 - [NSBlockOperation主] + 98 10基金会0x000000010aa7d774 - [__ NSOperationInternal _start:] + 645 11基金会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:与类型的未捕获的异常终止NSException

Please put exception breakpoint and run in debug mode to stop at the exact line of crash. 请放置异常断点并在调试模式下运行以在崩溃的确切行停止。

Clearly you are trying to access objects from an empty array which is bound to crash. 显然,您试图从一个空数组访问对象,而该数组肯定会崩溃。 It is always advisable to put a check on array size before accessing its elements. 始终建议在访问数组元素之前先检查一下数组大小。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM