Hello guys!
I have a problem with my UILocalNotification.
I am scheduling the notification with my method.
- (void) sendNewNoteLocalReminder:(NSDate *)date alrt:(NSString *)title{
// some code ...
UILocalNotification *localNotif = [[UILocalNotification alloc] init];
if (localNotif == nil)
return;
localNotif.fireDate = itemDate;
localNotif.timeZone = [NSTimeZone defaultTimeZone];
localNotif.alertAction = NSLocalizedString(@"View Details", nil);
localNotif.alertBody = title;
localNotif.soundName = UILocalNotificationDefaultSoundName;
localNotif.applicationIconBadgeNumber = 0;
NSDictionary *infoDict = [NSDictionary dictionaryWithObject:stringID forKey:@"id"];
localNotif.userInfo = infoDict;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotif];
[localNotif release];
}
Its work fine and I'm correctly receiving the notification. The problem is when I should cancel the notification. Im using this method.
- (void) deleteNewNoteLocalReminder:(NSString*) reminderID noteIDe:(NSInteger)noteIDE{
[[UIApplication sharedApplication] cancelLocalNotification:(UILocalNotification *)notification ????
}
Im not sure what to do here, how do I know wich UILocalNotification object i should delete? Is there a way to list all notifications? The only thing I have is a ID on wich reminder I should delete. I was thinkin about to save the UILocalNotification object in my "Note" object and get it that way, and when I saving to my SQLite database serialize the object and so on ... is there a smarter way?