开发者

next fire date in UIlocalNotification

开发者 https://www.devze.com 2023-01-21 05:43 出处:网络
Hi All I have created a UILocalNotification....& when i print开发者_Python百科 it NSLog(@\"Notification %@\",self.notification)

Hi All

I have created a UILocalNotification....& when i print开发者_Python百科 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.


UILocalNotification has a fireDate property that you can use.


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


Just use:

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

fromDate:self.localNotification.fireDate];

NSDate *nextFireDate = [calendar dateFromComponents:comps];
0

精彩评论

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

关注公众号