views:

885

answers:

2

I am trying to build an iPhone app. But at the time of compiling there is a message showing that

[Session started at 2009-01-29 18:25:40 +0600.]
2009-01-29 18:25:44.238 SimpleGame[3691:20b] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSCFArray objectAtIndex:]: index (1) beyond bounds (0)'
2009-01-29 18:25:44.247 SimpleGame[3691:20b] Stack: ( .........

Actually when I do active these code then this message is shown, code are:

NSMutableArray *todoArray = [[NSMutableArray alloc] init];
self.todos = todoArray;
[todoArray release];

How can I overcome this problem?

+1  A: 

It seems like you're trying to access outside the bounds of an empty array.

Bartek Tatkowski
A: 

put breakpoints on objc_exception_throw and [NSException raise]. This should show the error before it's actually thrown and should hopefully tell you enough to find the problem.

Tony

Tony Lambert