4

I am developing an iPhone app that delivers alerts at certain times using UILocalNotifications. Pressing the OK button on the alert launches the app so it can perform specific tasks.

So far, everything works beautifully in most cases: if the app is running and the alert fires, it works fine, and if the app is not running (but the phone is on), it works just as well.

However, if the alert fires when the screen is locked, one of two things happens.

  1. alert fires, and I "slide to unlock" immediately, then the app launches as expected.
  2. alert fires, but I wait to "slide to unlock" longer than 20 seconds (the time it takes the screen to lock (dim) again). When I finally unlock the screen, the alert shows, but does NOT launch the app.

I have looked throughout the Apple docs and this site, but cannot find an answer. I hope my explanation makes sense. Any thoughts?

4

2 回答 2

5

我认为这种行为是有道理的,不应该被规避(我认为这是不可能的)。如果用户在通知后几秒钟后滑动解锁,则很有可能他只是因为该通知而滑动解锁并想要进入应用程序。如果过了很多时间,通知仍然显示,但概率很低,用户因为这个通知而滑动解锁。他更有可能只是想写一封电子邮件或做一些完全不同的事情。所以最后一个通知的应用程序不应该启动。

于 2010-11-29T04:52:36.470 回答
0

感谢您快速而清晰的回答,Dominik。快速跟进:重新启动应用程序的目的是安排另一个警报。如果我一次发送多个警报(安排在不同的时间),并且用户没有为其中任何一个解锁手机,它们是否都在用户第一次解锁时同时出现?(我只希望最后一个出现)

再次感谢。

于 2010-11-29T17:38:34.563 回答