Hi All
I have created a UILocalNotification....& when i print开发者_Python百科 itNSLog(@"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];
精彩评论