Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArray0 objectAtIndex:]

时光毁灭记忆、已成空白 提交于 2019-12-25 06:49:52

问题


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.

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

回答1:


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.

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.



来源:https://stackoverflow.com/questions/36822576/terminating-app-due-to-uncaught-exception-nsrangeexception-reason-n

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!