开发者

Show local notification for selected hours for everyday iphone sdk

开发者 https://www.devze.com 2023-03-27 20:51 出处:网络
I have developed application, I have successfully integrated the code of the local notification. Now I want is to show notification for selected hours only.

I have developed application, I have successfully integrated the code of the local notification. Now I want is to show notification for selected hours only. For example I want to 开发者_运维问答show notification from 8:00 am to 8:00 pm every day every hours. so how I can set repeat interval for this task.

Thanks in advance. Satish


You can set the repeatInterval property of UILocalNotification.

To change the repeat interval or disable the notifications, I think your app will have to become active. For example, lets say you want to display the notifications from 8 AM to 8 PM. The 8 PM notification comes up but the user taps the 'close' button on the alert. In this case, I don't think anything can prevent the 9 PM notification from displaying unless your app becomes active between 8 & 9 PM.

In case the user does not close the notification & does come back to your app, you can check the current time & set the repeatInterval to 0 (don't repeat).

HTH,

Akshay

0

精彩评论

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