-1
为什么我在NSLog(@"%@", numbers[i]);
线路上出现线程错误?线程1:信号sigabrt错误
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[])
{
@autoreleasepool {
NSMutableArray *numbers = [NSMutableArray array];
int i;
//Create an arry with the number 0-9
for (i = 0; i < 10; ++i) {
numbers[i] = @(i);
//Sequence through the array and display the values
for (i = 0; i < 10; ++i) {
NSLog(@"%@", numbers[i]);
//Look how NSLog can display it with a singe %@ format
NSLog(@"====== Using a single NSLog");
NSLog(@"%@", numbers);
}
}
}
return 0;
}
这当然不是一个Xcode的问题。 – 2013-11-28 07:31:54
此外,您可以**读取(整个)异常消息 - 问题是您正在访问数组越界。 – 2013-11-28 07:33:16
如果你原谅了观察,虽然我很高兴你得到了你的问题的答案,但是,在将来,如果你发布有关错误或崩溃的问题,请务必发布完整的错误消息和堆栈跟踪。见[我的应用程序崩溃,现在什么?](http://www.raywenderlich.com/10209/my-app-crashed-now-what-part-1)。 – Rob