相关代码:
UILocalNotification *newNotification = [[UILocalNotification alloc] init];
if (newNotification) {
newNotification.fireDate = newFireDate;
newNotification.alertBody = @"查看闹钟:你妈妈喊你回家吃饭!";
newNotification.soundName = @"wakeup.caf";
newNotification.alertAction = @"alarm now!!!";
newNotification.repeatInterval = NSWeekCalendarUnit;
newNotification.applicationIconBadgeNumber = 1;
[[UIApplication sharedApplication] scheduleLocalNotification:newNotification];
NSLog(@"Post new localNotification:%@", [newNotification fireDate]);
}
上面代码中的@"wakeup.caf"是资源文件夹中的一个不到10秒的声音文件,单独点击试过可以播放。但是当通知响起时,播放的依然是系统默认的三全音,而没有播放设置的wakeup.caf,请问可能是什么原因?
UILocalNotification *newNotification = [[UILocalNotification alloc] init];
if (newNotification) {
newNotification.fireDate = newFireDate;
newNotification.alertBody = @"查看闹钟:你妈妈喊你回家吃饭!";
newNotification.soundName = @"wakeup.caf";
newNotification.alertAction = @"alarm now!!!";
newNotification.repeatInterval = NSWeekCalendarUnit;
newNotification.applicationIconBadgeNumber = 1;
[[UIApplication sharedApplication] scheduleLocalNotification:newNotification];
NSLog(@"Post new localNotification:%@", [newNotification fireDate]);
}
上面代码中的@"wakeup.caf"是资源文件夹中的一个不到10秒的声音文件,单独点击试过可以播放。但是当通知响起时,播放的依然是系统默认的三全音,而没有播放设置的wakeup.caf,请问可能是什么原因?