Question

This may sound like a silly question, however with the iOS 6 viewDidUnload no longer getting called, I'm interested in how to properly terminate an iOS app currently being debugged with xCode on the development device. Is hitting the stop button below enough?

enter image description here

What exactly happens when I hit that button? Is this the equivalent of sending a stop signal to the app, terminating the app immediately? Does any of the dealloc code gets called? The reason I'm asking is that after repeated debugging with start/stop I'm running into an issue where it appears as if my app is having random memory issues(No leaks are detected with profiling).

Your thoughts are appreciated!

Was it helpful?

Solution

Hitting stop kills the app instantly. No dealloc or other code gets called (notably none of your application delegate methods that may be saving data), the process is just terminated. All of the memory used by the process is then freed, and when you start again, you're starting from scratch.

This is unlikely to be the cause of "random memory" problems. If you can give more detail about the symptoms you're experiencing, there could be more to say.

The best way to simulate what a user might do is to hit the home button, then stop the process. This doesn't terminate your app, but you should be dealing with everything necessary when entering the background anyway.

OTHER TIPS

ApplicationWillTerminate is called once application is terminated properly. If you click on the stop button, your application is killed and you might not trace any method calls in that case. As there is no viewDidUnload or dealloc methods for UIViewController, however you can define your own dealloc method without calling the super dealloc.

You could have a look at the Application life Cycle. It might answer lot of questions.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top