سؤال

My app must sometimes show an UIAlertView when the Home button or the locking button is pushed or when the notification center is shown.

I show the Alert from the applicationWillResignActive delegate's method and everything is ok when home button is pushed or when notificacion center is shown. But there is a problem if the button which is pushed is the locking button (on/off button).

In that case, the Alert is not shown when I return to the app (if I used the Home button it is there). I don't do anything else in other AppDelegate methods which are executed. Also, then, when I show a new Alert (any Alert in the app) the Alert which hasn't been shown when I returned is shown after I dismiss the new one.

Please, could anybody help me?

Thanks in advance.

هل كانت مفيدة؟

المحلول

THE EASY, GIVE ME REP ANSWER:

When the app is put into the background, the app is suspended. Part of this process is closing open alert views.


THE I ACTUALLY KNOW WHAT I'M TALKING ABOUT ANSWER:

The logic behind this is that when the user hits the home button when an alert is displayed, they might be going to look for information on how to answer the alert. However, when the sleep button is pressed, the user has stopped using the device altogether. Apple knows that if they unlock thier device again 3 hours later and see something like Confirm Deletion, they will have absolutely no idea what they were just doing and what to do now.

This is known to cause a serious condition known as what-in-the-world-am-I-supposed-to-do-now-itis. Symptoms of this condition include hitting the round button at the bottom of the screen and subsequently holding on your app icon until it jiggles. They then hit the little 'x' button. This is not good for developer's pockets.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top