繁体   English   中英

UIlocalNotification中的下一个触发日期

[英]next fire date in UIlocalNotification

大家好
我在打印时创建了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}

但是我想访问该通知的下一个触发日期,我如何获得该值?
请为此提供任何帮助。

您不能直接将其作为属性访问,因为它是根据fireDate和repeatInterval计算的。

这是您问题的答案

如何从UILocalNotification对象获取下一个点火日期

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

只需使用:

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

fromDate:self.localNotification.fireDate];

NSDate *nextFireDate = [calendar dateFromComponents:comps];

您可以从[self.notification description](即nsstring)中访问下一个日期,并从返回的字符串中删除不需要的字符

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM