我经常被这个问题困扰,*由于未捕获的异常'NSRangeException'而终止应用程序,原因:'* -[__NSArrayM objectAtIndex:]: index 2 beyond bounds [0 .. 1]'
这使我的应用程序崩溃。我之前没有遇到过这个问题,但是有一天它开始出现,但是由于我有这么多数组,我什至不知道它来自哪里。有没有办法告诉应用程序不要因为这个错误而崩溃,或者找到导致问题的数组?
顺便说一句,每次我运行代码时,我都会这样做:
[messagename removeAllObjects];
[messageframe removeAllObjects];
[messagetext removeAllObjects];
[MapViewArray removeAllObjects];
[DeleteButtonArray removeAllObjects];
NSFileManager *fileManager = [NSFileManager defaultManager];
[fileManager removeItemAtPath:reloadPath error:NULL];
[fileManager removeItemAtPath:reloadInfoPath error:NULL];
[fileManager removeItemAtPath:uploadPath error:NULL];
[fileManager removeItemAtPath:uploadPathMap error:NULL];
这应该清除所有数组...