views:

55

answers:

1

Hi!

I am making an app where the user gets daily book recommendations from an online database. This all works just fine on iPhone and iPod Touch, but crashes (SIGABRT) on iPad on launch (default.png is shown first).

The error that is traced in the console is "Terminating app due to uncaught exception 'NSRangeException', reason: '* -[NSCFArray objectAtIndex:]: index (0) beyond bounds (0)'". This happens on the iPad simulator as well.

Can anyone shed any light on this? I would be most grateful!

btw: I have 4.0 as Base SDK deployment target is 3.1.3

A: 

Putting a breakpoint on objc_exception_throw will let you find where exactly the problem occurs (you are trying to get an element from an empty array).

w.m
Nice trick! Thanks a lot. I didnt know I could do that, although i probably should have known:-)Anyway: the problem occured when I was making a splashscreen appear, using a downloaded splash screen class. The specific line that made it crash was: [[[[UIApplication sharedApplication] windows] objectAtIndex:0] addSubview:self]; This works on the iPhone and iPod, but not on the iPad. Cant say i understand exactly why, but i quickly found out i dont need that splash screen anyway. Now it all works just fine!Thanks a lot!
Ezop