I have successfully assigned local notifications in my application using the following code:
Class cls = NSClassFromString(@"UILocalNotification"); if (cls != nil) { UILocalNotification *notification = [[cls alloc] init]; notification.fireDate = self.alarmNotificationDate; notification.timeZone = [NSTimeZone defaultTimeZone]; notification.alertBody = @"Alarm is due"; notification.alertAction = @"Show Alarm"; notification.soundName = @"alarm.mp3"; [[UIApplication sharedApplication] scheduleLocalNotification:notification]; [notification release];
Where self.alarmNotificationDate is assigned by NSDate in another way.
Everything works fine in the simulator, but when I test my reliable old iPhone 3G running iOS4, I get a notification, but only with standard sound.
I tried with various sound files but did not succeed.
Any clue why this might be the case and how to fix it?
thanks
source share