views:

147

answers:

1

I unsuccessfully tried to implement a playback audio that continues to play in background by setting the UIBackgroundModes property and by activating an audio session as Joshua Weinberg suggested, but it doesn't work on the simulator and I have no chance to test on a device with iOS4. I read about of a possible issue with the simulator, is it likely? Is there anyone who has produced code that works on the simulator? Thanks and sorry because I originally posted it as answer (since no "add comment" link was enabled).

+1  A: 

voidness,

It is working for me by implementing this code. This will not work in the simulator though for whatever reason. So if your code is the same or similar, have faith that it does work brilliantly on my iPod Touch with iOS4 installed.

App Delegate.m (either in init or applicationDidFinishLaunching)

- (id) init {   

    // allows you to play in the background when app is suspended in iOS4
    [[AVAudioSession sharedInstance] setDelegate: self];
    [[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayback error:nil];

}

And of course be sure to set the UIBackgroundModes key to audio like was stated before.

Best of luck,

Rob

iWasRobbed