开发者

How to show custom alert at specific time?

开发者 https://www.devze.com 2023-03-14 19:48 出处:网络
I\'m working on an alarm/reminder application and want to show a custom alarm view when specified time is reached.

I'm working on an alarm/reminder application and want to show a custom alarm view when specified time is reached.

From what I understand, there are various (real and hypothetic) ways of doing it:

  1. UILocalNotification. It would be perfect, but alert customization features are insufficient, e.g. I can't show a custom alert view, I can't play a sound for more than 30sec etc.
  2. Keep application in the background and use NSTimer or other means to schedule execution after some time. Most likely won't work as the app may be killed any time.
  3. Start my app at specified time to receive the notification. As far as I know it's not allowed at all.

After spending several days searching for a solution, I would give up and stick with UILocalNotification, but I DO know an app that shows custom alert view开发者_如何学Go at specific time AND is available in AppStore. The app is named "Alarmed" and from what it looks like (last app view shown on alarm time before an actual alert; alarm still triggers even after the device is restarted) they found a way to start their app at specific time and still pass Apple's review.

Any ideas how this can be done? Thanks.


It's not possible to show notifications other than what UILocalNotification offers you, unless the app is running in the foreground. (I just tried to install "Alarmed" and it uses a regular UILocalNotification like you'd expect).

0

精彩评论

暂无评论...
验证码 换一张
取 消