IPhone: Why does my app resume and not restart when I relaunch it on device? - iphone

I don't know if this is an iOS4 thing or something, but basically say I have a few screens in my app. Now, when I hit the home button and relaunch my app it launches the app on the screen where I left off. It's almost like it's not restarting my app, but resumes it. I don't want it to do that. (I'd like it to show my splash screen main menu, etc. )
Does anyone know how to resolve this? thanks

In iOS 4, apps are suspended (not terminated) when the home button is pressed. When you "relaunch" the app, it is simply moved to the foreground. If you want your app to terminate when the user presses the home button, set the value of UIApplicationExitsOnSuspend to YES in your app's Info.plist file. If you do this, when the user taps the home button the applicationWillTerminate: method of your app delegate will be called and then your application will terminate.

I think this should help you. Basically what you need to do is disable the multi-tasking features of iOS4.
http://www.iphonedevsdk.com/forum/iphone-sdk-development/60989-disable-multi-tasking-ios4-application.html

That's exactly the multi-tasking you asked about yesterday working behind the scenes. You need to opt-out if you want that behavior. See answers to your previous question here. Have you read the answers there???

Related

IPhone app shows previous state when opening

I have very weird problem. My app works cool on simulator but when installed on iphone it shows strange behavior
Suppose i was at settings page then I closed the app using home button. And then I start the app again after quite a while and I will always first get the settings page for one second and then the main loading screen. This happens for every other page even its not the settings ViewController
What is wrong?
Best Regards
Umar
Standard behavior, UI restoration. Your iOS apps picks up execution right where you left.
This means: if the app is pushed to background, a screenshot is taken. Coming back to the app, this screenshot will be shown and meanwhile your UI gets prepared.
If you have code in your app in applicationDidBecomeActive: or applicationWillEnterForeground: (see here: http://developer.apple.com/library/ios/#documentation/uikit/reference/UIApplicationDelegate_Protocol/Reference/Reference.html) and that will immediately reconfigure the UI, you get the behavior described.
You can turn OFF UI restoration and have your app really quit instead of pushing it to background by changing a key in the info.plist: UIApplicationExitsOnSuspend

How to get screenshot of home screen before app get launched

I have an iOS app and I need to get the home page screenshot before app launching. can I do that?
No. You can't fire events before the app launches, and even if you could, there'd be no way to get a screenshot of the springboard since there's no way to get its graphics context.
Sorry: to get a screenshot of the home screen on iPad, just press home button + power button, simoultaneously. Or I misunderstood the question ?

iphone lock button and the running app

this may be a simple one, but I don't know the answer.....
For testing whether my location-based app receives updates in background, I usually run the app and then press the Home button to put the app in background. However, I am curious whether pressing the Lock button (at the top) will put the app in background or not.
Regards.
Yes. Hitting the lock button does background the application. However when you unlock it, the application is then brought back to the foreground. Should be able to test this within your App Delegate and simple log statements.

Play splash movie every time app launch (with multi-task support)

the app I'm working on supports iOS multi-task feature by default, and I want to stick with this.
Upon app launch, a splash movie clip is played (code is in AppDelegate), after user hits the home button, and re-launches the app, I want to the same splash movie be played before showing the last view where use was.
I know by switching off the multi-task support, I can achieve this, but in the meanwhile, I'm losing the multi-task support feature, and I need to write code to save/resume user states. So, is there any workaround for this? thanks!
You could try the app delegate's applicationDidBecomeActive: method but quite frankly I'd consider this to be user hostile behaviour. Who wants to see a movie every time they switch between apps? The point of multitasking on the iPhone is to quickly change between apps and this violates that.

Home button doesn't exit app in iPhone simulator 4.0

I noticed that when building then running viewDidLoad only gets called once. If you press the home button and re-enter the application, viewDidLoad does not execute again.
Another thing I noticed is that when you re-enter an application it starts off right where you left off.
Is this the same behavior as in older SDKs? Does this mean that when the home button is pressed the application did not really exit?
When you press the home button, debugging is terminated and therefore you will not see anything from NSLog in the debugger console on any version of the SDK. You can try this by putting an NSLog in viewDidAppear:, which should get called even if the app is still running in the background in iOS 4, but doesn't
One difference with iOS4.0 is that if you press the home button your app might not necessarily terminate. The default setting is that they that will still be loaded in memory. This is the new 'multi-tasking' feature of iOS4.0. Turn it off and your app should be loaded every time.
UIApplicationExitsOnSuspend is the key for your plist to enable/disable background running.
With new iOS 4, multitasking arrived on iPhone and iPod Touch...
For this, when you are debugging or developing an application with the iPhone Simulator, if you press the home button, your app go in background or multitasking. Than Xcode believe that your app is still in use.
For recalling viewDidLoad method, you must completely exit from your app by pressing twice home button then hold down your app in the multitasking bar and tapping on the X.