UILocalNotification每个工作日/ 15分钟

时间:2023-01-30 01:18:42

I'm trying to make something and I need to know if my thinking is right with some help of you guys that have more experience with UILocalNotifications and stuff.

我正在尝试制作一些东西,我需要知道我的想法是否正确,你们有一些帮助,他们对UILocalNotifications和东西有更多的经验。

So I want to send a Local Notification to the user each working day (Monday - Friday / 8:00 - 16:00) and between those working hours notify the user every 15 minutes.

所以我想在每个工作日(周一至周五/ 8:00-16:00)向用户发送本地通知,并且在这些工作时间之间每15分钟通知用户一次。

There's a limit of 64 Local Notifications if I understand that I can store inside the system. But for 1 day I would need like 32 notifications to setup (8 Hours working * 4 notifications each hour). So I could only setup 1 - 2 days that the user would receive notifications.

如果我知道我可以存储在系统内,则有64个本地通知的限制。但是对于1天我需要设置32个通知(8小时工作*每小时4个通知)。所以我只能设置1-2天用户会收到通知。

So how could I manage the other 3 days from Wednesday - Friday? How would you guys do this?

那么我怎样才能管理周三到周五的其他3天?你们会怎么做?

Should i need to store all NSDates in an Array, and always check on the current day and stuff then setup the LocalNotification when opening the app?

我是否需要将所有NSDate存储在一个数组中,并始终检查当前日期和内容,然后在打开应用程序时设置LocalNotification?

With kind regards

亲切的问候

1 个解决方案

#1


1  

You could use Apples Push Notification if the app is not opened often enough to post the new LocalNotifications and you have an internet connection all the time. If you want to post the LocalNotifications at every start of the app, I would suggest you to generate the notifications (after deleting the old ones: [[UIApplication sharedApplication] cancelAllLocalNotifications];), because then you does not need to save them anywhere.

如果应用程序未经常打开以发布新的LocalNotifications并且您始终具有Internet连接,则可以使用Apples推送通知。如果你想在应用程序的每个开始时发布LocalNotifications,我建议你生成通知(删除旧通知后:[[UIApplication sharedApplication] cancelAllLocalNotifications];),因为那时你不需要将它们保存在任何地方。

#1


1  

You could use Apples Push Notification if the app is not opened often enough to post the new LocalNotifications and you have an internet connection all the time. If you want to post the LocalNotifications at every start of the app, I would suggest you to generate the notifications (after deleting the old ones: [[UIApplication sharedApplication] cancelAllLocalNotifications];), because then you does not need to save them anywhere.

如果应用程序未经常打开以发布新的LocalNotifications并且您始终具有Internet连接,则可以使用Apples推送通知。如果你想在应用程序的每个开始时发布LocalNotifications,我建议你生成通知(删除旧通知后:[[UIApplication sharedApplication] cancelAllLocalNotifications];),因为那时你不需要将它们保存在任何地方。