由于未捕获的异常'NSRangeException'而终止应用程序,原因:'***-[__ NSArray0 objectAtIndex:] [英] Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArray0 objectAtIndex:]

查看:222
本文介绍了由于未捕获的异常'NSRangeException'而终止应用程序,原因:'***-[__ NSArray0 objectAtIndex:]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在iPhone 6上运行应用程序,但出现此错误.进行Facebook登录后出现错误.通常,它可以在模拟器上成功运行.我找不到为什么会显示错误.

I am trying to run app on the iphone 6 and I get this error. I get the error after making the facebook login. Normally, it is working successfully on the simulator. I couldn't find why it gives the error.

错误:

 *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArray0 objectAtIndex:]: index 0 beyond bounds for empty NSArray'
    *** First throw call stack:
    (0x181dcae38 0x18142ff80 0x181d41a6c 0x100418620 0x100417aa0 0x10042dbac 0x10006a3a0 0x10006aa0c 0x186f14b40 0x186f14744 0x1872ba9fc 0x1872774f4 0x187273f04 0x1871c6fd8 0x1871d4990 0x186f064a4 0x181d807b0 0x181d7e554 0x181d7e984 0x181ca8d10 0x183590088 0x186f7df70 0x10008810c 0x1818468b8)
    libc++abi.dylib: terminating with uncaught exception of type NSException

推荐答案

由于您未发布任何堆栈跟踪,因此我假设您想学习如何查找此类错误.首先,在Xcode中,为Objective-C异常设置一个断点,以便您确切地了解崩溃发生的位置.

Since you posted no stack trace, I assume you want to learn how to find bugs like this. First, in Xcode, set a breakpoint on Objective-C exceptions, so you find where exactly the crash happens.

该错误清楚地表明您正在尝试为空的NSArray访问数组[0].一旦找到崩溃的位置,就应该很容易找到.

The error says clearly that you are trying to access array [0] for an NSArray that is empty. Once you find the location of the crash that should be easy to find.

这篇关于由于未捕获的异常'NSRangeException'而终止应用程序,原因:'***-[__ NSArray0 objectAtIndex:]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆