如何将本地通知重复间隔设置为自定义时间间隔? [英] How to set Local Notification repeat interval to custom time interval?

查看:126
本文介绍了如何将本地通知重复间隔设置为自定义时间间隔?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个需要本地通知的iPhone应用程序。



在本地通知中有 repeatInterval



我想要的重复间隔应该是4小时。



每隔 4小时,本地通知就会发出。



我不希望用户为每个。



我希望用户能够将repeatInterval设置为4小时。



解决方案

获得答案



您必须使用NSCalendarUnit的内建单位时间间隔



我尝试了所有上述解决方案,但他们都没有工作。



我投入了足够的时间发现自己的时间间隔没有办法让它工作。



希望这有助于所有正在寻找解决方案的人。



感谢所有试图回答我问题的人。谢谢你们!


I am making an iPhone app, which has a requirement of Local Notifications.

In local notifications there is repeatInterval property where we can put the unit repeat intervals for mintute, hour, day,week,year, etc.

I want that repeat interval should be 4 hours.

So every 4 hours the local notification comes.

I dont want the user to set seperate notifications for each.

I want the user to be able to set repeatInterval as 4 hours.

How do I do that?

解决方案

Got the answer

It is as straight as it gets.

You cannot create custom repeat intervals.

You have to use on NSCalendarUnit's in-built Unit Time Intervals.

I tried all the above solutions and even tried other stuffs, but neither of them worked.

I have invested ample time in finding out that there is no way we can get it to work for custom time intervals.

Hope this helps all who are looking out for the solution.

Thanks to all the guys who tried to answer my question. Thanks Guys!!

这篇关于如何将本地通知重复间隔设置为自定义时间间隔?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆