NSRangeException 与 NSArray objectAtIndex,索引超出范围

发布于 2024-09-03 22:37:47 字数 198 浏览 3 评论 0原文

谁能告诉我以下错误在 iOS Objective-C 中意味着什么:

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

Can anyone let me know what the following error means in iOS Objective-C:

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不即不离 2024-09-10 22:37:48

这意味着您的索引不在数组的有效范围内。您的数组有 13 个元素,您正在尝试访问第 14 个元素。在 C 中,索引从 0 开始,因此数组的索引从 0 到 length - 1 有效。

这通常是由 因一个错误而关闭

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. In C, indexes start at 0, so arrays have indexes that are valid from 0 to length - 1.

This is typically caused by an off by one error.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文