UILocalNotification *localNotif;
//==================== Add Local Notification ===========================
localNotif = [[UILocalNotification alloc] init];
localNotif.fireDate = dateStartDate;
localNotif.timeZone = [NSTimeZone defaultTimeZone];
localNotif.alertBody = txtName.text;
localNotif.alertAction = @"View";
localNotif.soundName = UILocalNotificationDefaultSoundName;
// Specify custom data for the notification
infoDict = [[NSMutableDictionary alloc] initWithObjectsAndKeys:txtName.text,@"name",nil];
localNotif.userInfo = infoDict;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotif];
[localNotif release];
//=========================================================
//============ Delete Previous Notification ==================
UILocalNotification *notificationToCancel=nil;
for(UILocalNotification *aNotif in [[UIApplication sharedApplication] scheduledLocalNotifications]) {
if( [[aNotif.userInfo objectForKey:@"name"] isEqualToString:[editTask objectForKey:@"name"]]) {
notificationToCancel=aNotif;
break;
}
}
if(notificationToCancel)
[[UIApplication sharedApplication] cancelLocalNotification:notificationToCancel];
//==================================
//==================== Add Local Notification ===========================
localNotif = [[UILocalNotification alloc] init];
localNotif.fireDate = dateStartDate;
localNotif.timeZone = [NSTimeZone defaultTimeZone];
localNotif.alertBody = txtName.text;
localNotif.alertAction = @"View";
localNotif.soundName = UILocalNotificationDefaultSoundName;
// Specify custom data for the notification
infoDict = [[NSMutableDictionary alloc] initWithObjectsAndKeys:txtName.text,@"name",nil];
localNotif.userInfo = infoDict;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotif];
[localNotif release];
//=========================================================
//============ Delete Previous Notification ==================
UILocalNotification *notificationToCancel=nil;
for(UILocalNotification *aNotif in [[UIApplication sharedApplication] scheduledLocalNotifications]) {
if( [[aNotif.userInfo objectForKey:@"name"] isEqualToString:[editTask objectForKey:@"name"]]) {
notificationToCancel=aNotif;
break;
}
}
if(notificationToCancel)
[[UIApplication sharedApplication] cancelLocalNotification:notificationToCancel];
//==================================
Nice post with great details. Thanks for sharing your info. notification software
ReplyDelete