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.
Related
When developing an app, it is sometimes useful to force-quit an application without having to re-start the entire device.
On my iPhone, I can force-quit the active app by double-clicking the home button and swiping the app to the top.
For the actual Apple Watch (not the simulators), force-quitting an app is particularly useful since there are sometimes connection problems between Xcode and the watch app. Also, sometimes I would like to force-quit my Apple Watch app when it is not connected to Xcode.
So, how can I force-quit / terminate the active app on the Apple Watch without restarting the entire device?
When the app that you would like to terminate is open:
Press and hold the side button and wait until the shut down screen appear. Then let go of the side button.
Press and hold the side button again until the home screen appears.
Your formerly active app has now been terminated.
PS: The side button is the button below the Digital Crown.
My simulator crashes when I try to terminate my app from the recent-apps bar.
When I hit the home button and then my app, the app goes back to where it was, just like it should.
But when i hit the home button, and then the home button twice, and then holding my app and press the (-). The simulator goes in the background and xcode says it crashes. When I hit my app on the simulator now, the simulators screen goes black and won't load anything, and xcode is coming up with a crash message again.. and the simulator is frozen on the black screen...
What do you think is wrong?
It's nothing to worry about. This is a normal feature of XCode debugging session.
Make sure you stop the debugging session in XCode (hitting the stop - black square - button) and run your application again directly from simulator (not from XCode). It should work now.
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.
hallo, i am newbie in developing iphne/ios application and i have
encountered some problem
generrraly my app (which is iphone camera image processing app) has no
visible errors at today stage except the one
when i press the home button to send my app off screen (putting to the
background), and then press the app icon to 'wake it up' again
it crashes
what would it be...? what the reason of it would be?
what is done to my app (seen from the view of programmer
- i mean internal game state) by this home buton operation?
- what i should take care of before "applicationDidEnterBackground"
eventually?
thanx for answer
Is this happening when you are running it from Xcode? Xcode does not like it if you hit the home button and start it again from within the device/simulator. Is it crashing if you launch it from the device (or simulator) without Xcode running? If not, then there probably isn't a problem.
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???