NSRangeException错误

时间:2012-04-07 16:49:24

标签: iphone objective-c xcode

我是obj c n00b所以请原谅我,如果这是一个愚蠢的问题,但是当这个JSON调用发生时我的应用程序崩溃了,而不是之前。我95%肯定它与服务器上的php调用有关。会喜欢这方面的任何想法。 :)

谢谢!

这是它破裂的地方......

else if([ret_st hasPrefix:@"Account veri"]){


    NSMutableArray *Array=[ret_st componentsSeparatedByString:@"_"];
    appDelegate.user_id=[Array objectAtIndex:1];

NSLog(@“user_id%@”,appDelegate.user_id);

2012-04-07 09:43:51.094 App [57919:15e03] request requestType = signup& name = Test& email=test@test.com& password = test& zip = 90084& id = 22 return_strr Account Verified204     2012-04-07 09:43:51.094 App [57919:15e03] *由于未捕获的异常'NSRangeException'终止应用程序,原因:'* - [__ NSArrayI objectAtIndex:]:索引1超出边界[ 0 .. 0]'      * 第一次抛出调用堆栈:     (0x1a23022 0x1e0ccd6 0x1a0f644 0xdb5d 0x10a85d 0x19f7936 0x19f73d7 0x195a790 0x1959d84 0x1959c9b 0x230d7d8 0x230d88a 0x442626 0x279d 0x2065)     终止调用抛出异常

1 个答案:

答案 0 :(得分:0)

某处你有一个数组,其中一个对象在索引0(bounds [0 .. 0]),但是你要求索引为1的对象(索引1超出边界)。检查您的代码是否为objectAtIndex:来电。