Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

newtoiphonesdk

macrumors 6502a
Original poster
Jul 30, 2010
567
2
I am working on an app to airplay audio to a supported device, similar to pandora. In the AppDelegate .h @interface I have:
Code:
UIBackgroundTaskIdentifier *backgroundTask;
In the .m I have:
Code:
@implementation VideoAppAppDelegate

@synthesize window;
@synthesize viewController;


- (void)applicationDidFinishLaunching:(UIApplication *)application {    
    
    // Override point for customization after app launch    
    [window addSubview:viewController.view];
    [window makeKeyAndVisible];
	[[ UIApplication sharedApplication ] setIdleTimerDisabled: YES];

}
- (void)applicationDidEnterBackground:(UIApplication *)application
{
	NSAssert(backgroundTask == UIBackgroundTaskInvalid, nil);
	backgroundTask = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:nil];
}

- (void)applicationWillEnterForeground:(UIApplication *)application
{
	[[UIApplication sharedApplication] endBackgroundTask:backgroundTask];
	backgroundTask = UIBackgroundTaskInvalid;
}

- (void)dealloc {
    [viewController release];
    [window release];
    [super dealloc];
}


@end
I then add the required background mode in .plist of App plays audio in the background. When I am using Airplay, however, and try to run a different app, it pauses. Any ideas for how to accomplish this?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.