I have an application in which i have button. When i click on button then generate a local notification. The variable of local notification is set in appDelegate file. For generate local notification i used this code:-
UILocalNotification* ln = [[UILocalNotification alloc] init]; ln.alertBody = @"Time for another cup of coffee!"; ln.applicationIconBadgeNumber = 1; ln.fireDate = notification_date; //[NSDate dateWithTimeIntervalSinceNow:15]; ln.timeZone = [NSTimeZone timeZoneWithAbbreviation:@"GMT"]; NSString *string_date=[formatter stringFromDate:notification_date]; NSDateFormatter* formatter_alarm = [[[NSDateFormatter alloc] init] autorelease]; formatter_alarm.timeZone = [NSTimeZone timeZoneWithAbbreviation:@"GMT"]; [formatter_alarm setDateFormat:@"hh:mm a"]; NSString *str=[formatter_alarm stringFromDate:notification_date]; appDelegate.alarm_time=[NSString stringWithFormat:@"%@",str]; NSLog(@"%@",appDelegate.alarm_time);
[[NSUserDefaults standardUserDefaults] setObject:appDelegate.alarm_time forKey:@"alarm_on_time"];
[[NSUserDefaults standardUserDefaults] setObject:string_date forKey:@"alarm_on_date"];
[[NSUserDefaults standardUserDefaults] synchronize];
NSLog(@"alarm will activate on%@",notification_date);
ln.soundName = @"alarm.wav";
AudioServicesPlayAlertSound(kSystemSoundID_Vibrate);
ln.repeatInterval=NSDayCalendarUnit;
[[UIApplication sharedApplication] scheduleLocalNotification:ln];
// if(appDelegate.appDelegate_notification ==nil) // appDelegate.appDelegate_notification= [[UILocalNotification alloc] init]; appDelegate.appDelegate_notification=ln; [ln release];
Now i have a another button which is used for change the sound of local notification. I wan t that when user click on that button then change the sound of local notification. For that purpose i use this code:-
appDelegate.appDelegate_notification.soundName = @"Blow.wav";
Now problem is that when i click on another button then sound of local notification is not changed. How make that event on button click?
Thanks in advances...