简体   繁体   English

NSRangeException与NSArray objectAtIndex,索引超出范围

[英]NSRangeException with NSArray objectAtIndex, index beyond bounds

谁能告诉我以下错误在iOS Objective-C中的含义:

Terminating app due to uncaught exception 'NSRangeException', reason: '-[NSCFArray objectAtIndex:]: index (13) beyond bounds (13)'

It means that your index is not within the valid range for your array. 这意味着您的索引不在数组的有效范围内。 Your array has 13 elements and you are trying to access the 14th element. 您的数组有13个元素,并且您正在尝试访问第14个元素。 In C, indexes start at 0, so arrays have indexes that are valid from 0 to length - 1. 在C语言中,索引从0开始,因此数组具有从0到长度-1的有效索引。

This is typically caused by an off by one error . 这通常是由一个错误关闭引起的。

暂无
暂无

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

相关问题 由于未捕获的异常“ NSRangeException”而终止应用程序,原因:“ ***-[__ NSArray0 objectAtIndex:]:索引0超出了空NSArray的范围” - Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArray0 objectAtIndex:]: index 0 beyond bounds for empty NSArray' 异常“ NSRangeException”,原因:“ ***-[__ NSArray0 objectAtIndex:]:空NSArray的索引0超出范围” - exception 'NSRangeException', reason: '*** -[__NSArray0 objectAtIndex:]: index 0 beyond bounds for empty NSArray' ***由于未捕获的异常'NSRangeException'而终止应用程序,原因:'***-[__ NSArray0 objectAtIndex:]:索引0超出了空NSArray的范围 - *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArray0 objectAtIndex:]: index 0 beyond bounds for empty NSArray ***由于未捕获的异常“ NSRangeException”而终止应用程序,原因:“ ***-[__ NSArray0 objectAtIndex:]:索引0超出了空NSArray的范围” - *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArray0 objectAtIndex:]: index 0 beyond bounds for empty NSArray' 由于未捕获的异常“ NSRangeException”而终止应用程序,原因:“ ***-[__ NSArray0 objectAtIndex:]:空NSArray的索引2超出范围 - Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArray0 objectAtIndex:]: index 2 beyond bounds for empty NSArray 'NSRangeException',原因:'* -[__NSArrayM objectAtIndex:]:索引 2 超出范围 [0 .. 1]' - 'NSRangeException', reason: '* -[__NSArrayM objectAtIndex:]: index 2 beyond bounds [0 .. 1]' 'NSRangeException',原因:'*** - [__ NSArrayM objectAtIndex:]:索引1超出边界[0 .. 0]' - 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 1 beyond bounds [0 .. 0]' NSRangeException。 对于空NSArray索引0超出范围 - NSRangeException. For empty NSArray index 0 beyond bounds NSArray objectAtIndex索引1超出[0,0]? - NSArray objectAtIndex index 1 bounds beyond [0,0]? NSArray objectAtIndex索引0超出空数组的边界 - NSArray objectAtIndex index 0 beyond bounds for empty array
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM