Make Application don't run in BackGround

Hi folks,

How I can do my iphone (ofxIphone) Application don’t run in background??

Leo, Rio Brazil.

P.S.: my english isn’t goog.

Apple encourages you not to do this, but I don’t think they enforce it. At least I hope not. I suppose it might depend on how long it takes your app to load from scratch vs a resume. Interestingly, they say adding to your plist

UIApplicationExitsOnSuspend YES

should work, but it seems to do nothing for me.

So this is what I’m doing. It seems to work but am not 100% sure of my cleanup code.


- (void) applicationDidEnterBackground:(UIApplication *)application {  
	ofLog(OF_LOG_WARNING, "applicationDidEnterBackground");  
		[[NSNotificationCenter defaultCenter] removeObserver: self];  
		[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];  
		[glView release];  
		[self dealloc];  

In my code:

//	Called when user hits app close button OR when an interrupting app takes complete control  
int testApp::applicationDidEnterBackground(){  
	// return true to force complete app quit   
	// This makes the app more reliable sound wise - esp correctly detecting if ipod is playing on resumption.  
	//	but it is a bit of a hack technically! Note app cleanup code gets called OK  

where class testApp : public ofxiPhoneApp. Obviously the testApp.h also needs

int applicationDidEnterBackground();