Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone app startup

Tags:

iphone

startup

How do I make my iPhone app start at the same place each time, i.e. my 'home' screen? I do NOT want the user to return to where they were last time they played - right in the middle of gameplay - but that's what's happening. Thanks in advance for any tips!

like image 690
Mike Amadeo Avatar asked May 03 '26 16:05

Mike Amadeo


2 Answers

You need to set the UIApplicationExitsOnSuspend key in your info.plist file to YES. Then the app will quit when the home button is pressed, and launch fresh when it is opened again.

like image 78
peterjb Avatar answered May 05 '26 05:05

peterjb


This is presumably only happening because your app isn't really being stopped - it's simply being backgrounded. (If you double click the home button whilst viewing springboard does it show up at the bottom? If so, it's still running.)

You can disable this behaviour (so your app quits when the user hits the home button) by setting the UIApplicationExitsOnSuspend key (known as "Application does not run in background" within Xcode) in your info.plist file. See Apple's Information Property List Key Reference docs for more information.

Alternatively, you could simply capture the applicationDidEnterBackground: UIApplicationDelegate method in your app's add delegate and handle the situation from there programatically. (i.e.: Do whatever you need to do to reset your app back to the 'home' screen, etc.)

like image 40
John Parker Avatar answered May 05 '26 04:05

John Parker



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!