Various events besides termination can interrupt your application to allow the user to respond — for example, incoming phone calls, SMS messages, calendar alerts, or the user pressing the Sleep button on an iPhone. Such interruptions may only be temporary. If the user chooses to ignore an interruption, your application continues running as before. If the user decides to answer the phone or reply to an SMS message, however, your application will be terminated.
Figure 6-8 shows the sequence of events that occurs during the arrival of a phone call, SMS message, or calendar alert. Here’s what that looks like step by step:
1. The system detects an incoming phone call or SMS message, or a calendar event occurs.
2. The system sends your application delegate the applicationWill ResignActive: message.
Because these interruptions cause a temporary loss of control by your application — meaning that touch events are no longer sent to your applications — it is up to you to prevent what is known in the trade as a "negative user experience." For example, if your application is a game, you should pause the game.
3. The system displays an alert panel with information about the event.
The user can choose to ignore the event or respond to it.
4. If the user ignores the event, the system sends your application delegate the applicationDidBecomeActive: message and resumes the delivery of touch events to your application.
You can use this delegate method to restore the application to the state it was in before the interruption. What you do depends on your application. In some applications, it makes sense to resume normal processing. In others — if you’ve paused a game, for example — you could leave the game paused until the user decides to resume play.
5. If the user responds to the event, instead of ignoring it, the system sends your application delegate the applicationWillTerminate: Message.
Your application should do what it needs to do in order to terminate gracefully.
The way the Sleep/Wake button is handled is a little different. When the application enters or resumes from a sleep state, two messages are sent to the application delegate: applicationWillResignActive: and applica-tionDidBecomeActive:, respectively. In this case, your application always resumes, though the user might immediately launch a different application.
It truly is difficult to find advised people with this matter, however you be understood as you are aware of what you are preaching about! Thanks
Hi there I located your site by mistake when i was searching Msn for this issue, I have to point out your page is quite very helpful I also love the theme, its good!
Book marked, I enjoy your site!
Large addict on this site, quite a few your blogposts have truly helped me out. Awaiting improvements!