UI Local Notification - Background Reschedule

本小妞迷上赌 提交于 2019-12-10 11:57:32

问题


I'm learning to develop application for ios with swift, and I'm one doubts, already googled and i not found.

I'm creating a to-do list app, and was wondering if there is a way to reschedule a notification when it appears to the user

For example the user registers a task every two hours, then the notification appears to the user and reagendo the new notification

Can anyone help me?

Thank you


回答1:


You can't do it in background if your app is suspended. But UILocalNotification supports recurrent notifications.
All you have to do is to declare the recurring interval: notif.repeatInterval = NSDayCalendarUnit;

You can find more details here.

Note that you can't set custom intervals. You must use the default ones provided by Apple.



来源:https://stackoverflow.com/questions/30737728/ui-local-notification-background-reschedule

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!