开发者

NSRangeException Issue

I am writing a Core Data-based iPhone app and I am new to Objective-C.

I have a bug that I am really struggling to nail. The iPhone simulator keeps crashing with the following error message:

2010-03-21 17:37:40.583 Patients[3689:207] * Terminating app due to uncaught exception 'NSRangeException', reason: '* -[NSCFArray insertObject:atIndex:]: index (1) beyond bounds (1)' 2010-03-21 17:37:40.585 Patients[3689:207] Stack: ( 31007835, 2516698377, 31091771, 31091610, 601273, 197333, 3194546, 3141378, 25020, 29768673, 214570, 30740485, 204512, 29114749, 29505379, 29001194, 29252410, 29190487, 30794322, 30791263, 30788680, 39097877, 39098074, 2883503, 9912, 9766 )

This error happens when I press return on a textField. What happens when the return key is pressed is that an attribute on an entity is updated.

I don't know what array is out of bounds as I am not using any arrays in my code!

Is there any way of getting more detail as to where in开发者_如何学Go my code the error is??

Thanks,


In the debugger menu you can have it break on exceptions. There are a a number of ways to do this.

On way is to select it directly in Xcode from the menu Run->Stop on Objective-C Exceptions.

An alternative way is to add the following entry into the .gdbinit file in your home folder (~/.gdbinit):

fb -[NSException raise]

This will have gdb always break into the debugger when somebody tries to throw an exception. You can also manually add the breakpoint when you launch the application in the debugger. Just leave out the "fb" part of the command when adding.

Hope these help,

Claus


When this happens, try running Debugger from Run menu immediately when the crash happens. It will show you exactly which line crashed. You could then post some code here. Without the code, we can't tell you anything.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜