开发者

Is there a safe way to schedule an alert for an calendar app?

I want to make a special calendar app, but I am afraid it's not possible to safely schedule an alert for an event.

For example: I set up an alert for an event which starts in 3 months. I want to get notified 2 days before the event starts. In iOS 4 there is multitasking, so my app could run in the background all the time.

But now lets imagine it's a hardcore iPhone user who plays huge memory-intensive games all the time. At some point, iOS might kill my background app. Or the user might restart the device and forget to launch my app. So it could happen that the alert never happens. Bad thing.

Is there a safe way to ensure t开发者_StackOverflow中文版hat an scheduled alert is thrown at the user, just like it is the case with the built in alarm clock app or the calendar app?


I'm going to bring back the EventKit notification - use event kit to schedule a calendar entry with an alert, and embed in there a URL that will open your app.

You could also use local notifications but this way the user will be able to see the upcoming event when reviewing the calendar, and even modify slightly if need be. They can't mess with a local notification once it's in place...


You want to use UILocalNotification for this.

EventKit will make it pop up in the user's calendar, maybe not what you want here.

BTW: Multitasking is really more "fast switching" than backgrounding in iOS... you won't be able to run arbitrary code in background, and you should expect to be killed anytime.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜