I have a problem with my UILocalNotification.
I schedule a notification using 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]; }
His work is beautiful, and I receive the notification correctly. The problem is that I have to cancel the notification. I am using this method.
- (void) deleteNewNoteLocalReminder:(NSString*) reminderID noteIDe:(NSInteger)noteIDE { [[UIApplication sharedApplication] cancelLocalNotification:(UILocalNotification *)notification ???? }
I'm not sure what to do here, but my questions are:
How do I know which UILocalNotification object I should delete?
Is there a way to list all notifications?
The only thing I have is a reminder id that I have to delete.
I was thinking about saving the UILocalNotification object in my Note object and getting it that way, and when I save the serialization of the object in my SQLite database, etc ... is there a smarter way?
iphone cocoa-touch ios4 notifications
f0rz Jul 01 '10 at 13:32 2010-07-01 13:32
source share