开发者

Send notification each day with different information

i want to send a notification each day at the same time with different information. I got no problem with showing the alert when i want to. The problem is what to show. First i tried to schedule one alert every day with different information in them, but that seems really inefficient. Then i tried with

-(void)application(UIApplica开发者_StackOverflowtion*)app didReceiveLocalNotification:(UILocalNotification *)Notif{}

but found out that it runs when the application is running in foreground only.

Is there any way to provide an array or something like it with the alert and tell the alert to get its body from the array with different index for different days?

Or should i do it with some notification that can run when the app is in background mode and the alert show and make a new alert?


All information must be provided when you schedule a local notification, so no, a notification's body cannot be sourced from an array as you described. If users are likely to open your app often and you know notification content in advance, perhaps you could ensure that x notifications are always scheduled (could be achieved by inspecting UIApplication's scheduledLocalNotifications).

This solution isn't ideal though, as it relies on users opening your app on a (somewhat) regular basis. I think push notifications are probably your best bet, but that requires access to a server, etc.


Yeah push could prob be the solution. But i dont have a server for that. The users will most likeley not open it any more after they have opened it the first time to activite the local-messages. So then this isnt really possible to do without push. when i tried a for-loop to schedule 250 days with different text each day it took about 2 minutes on iphone 4 so its not duable.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜