views:

18

answers:

0

Hi, I'm developing an app for both iPad and iPhone OS 4, I need TV Out support for both, my code works fine on iPad running iOS 3.2 but when I try it on an iPod with iOS 4.0 it breaks:

if ([UIHardware TVOutCapable]) { //returns true in both devices with cable connected
    //the followin line breaks
    UIScreen *externalScreen=[[[UIScreens screens] objectAtIndex:1] retain];
    id screenModes = [[externalScreen availableModes] retain];
    id selectedMode = [screenModes objectAtIndex:0];
    [externalScreen setCurrentMode:selectedMode];
    [self.tvOutWindow setScreen:externalScreen];
    [externalScreen release];
    [screenMores release]
}

I get an NSRangeException telling me that [UIScreens screens] has only one element (index 1 beyond bounds 0..0), I used the same cable (Apple original RCA), the cable works fine with Youtube app in both iOS3.2, and 4.0, my questions are...

Does iOS4 support multiple screens just like iOS3.2? or what changes should I make to my code in order to make it compatible with both.

Any suggestions are greatly appreciated.