UIlocalNotification 中的下一个触发日期

发布于 2024-09-28 06:28:35 字数 447 浏览 0 评论 0原文

大家好
我创建了一个 UILocalNotification...&当我打印它时,

NSLog(@"Notification %@",self.notification)

它给出

Notification <UIConcreteLocalNotification: 0x6f45440>
{fire date = 2010-10-22 00:09:00 -0700, time zone = America/Vancouver (PDT) offset -25200
(Daylight), repeat interval = 64, **next fire date** = 2010-10-22 00:10:00 -0700}

但我想访问此通知的下一个触发日期我怎样才能获得这个值?
请为此提供任何帮助。

Hi All
I have created a UILocalNotification....& when i print it

NSLog(@"Notification %@",self.notification)

it gives

Notification <UIConcreteLocalNotification: 0x6f45440>
{fire date = 2010-10-22 00:09:00 -0700, time zone = America/Vancouver (PDT) offset -25200
(Daylight), repeat interval = 64, **next fire date** = 2010-10-22 00:10:00 -0700}

But I want to access the next fire date of this Notification how can i get this value?
Please any help for this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

国粹 2024-10-05 06:28:35

UILocalNotification 有一个 fireDate 您可以使用的属性。

UILocalNotification has a fireDate property that you can use.

白鸥掠海 2024-10-05 06:28:35

您无法直接将其作为属性访问,因为它是根据 fireDate 和 RepeatInterval 计算的。

这是您问题的答案

如何抓取来自 UILocalNotification 对象的下一个触发日期

You can't access it directly as a property, because it is calculated based on fireDate and repeatInterval.

Here is the answer to your question

How to grab the NEXT fire date from a UILocalNotification object

逆光飞翔i 2024-10-05 06:28:35

只需使用:

NSCalendar *calendar = [NSCalendar currentCalendar];    
NSDateComponents *comps = [calendar components:self.localNotification.repeatInterval 

fromDate:self.localNotification.fireDate];

NSDate *nextFireDate = [calendar dateFromComponents:comps];

Just use:

NSCalendar *calendar = [NSCalendar currentCalendar];    
NSDateComponents *comps = [calendar components:self.localNotification.repeatInterval 

fromDate:self.localNotification.fireDate];

NSDate *nextFireDate = [calendar dateFromComponents:comps];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文