@
Mattsive 代码现在写成:
UILocalNotification *newNotification = [[UILocalNotification alloc] init];
if (newNotification) {
newNotification.fireDate = newFireDate;
newNotification.alertBody = @"查看闹钟:你妈妈喊你回家吃饭!";
NSString* soundPath = [[NSBundle mainBundle] pathForResource:@"wakeup" ofType:@"caf"];
NSLog(@"soundPath:%@", soundPath);
newNotification.soundName = soundPath;
newNotification.alertAction = @"alarm now!!!";
newNotification.repeatInterval = NSWeekCalendarUnit;
[[UIApplication sharedApplication] scheduleLocalNotification:newNotification];
NSLog(@"Post new localNotification:%@", [newNotification fireDate]);
}
神奇的是我把打不出来的NSLog那句删掉重写了一遍,日志就能打出来了,结果是
2012-05-09 02:45:39.570 CuteAlarm[2106:707] soundPath:/var/mobile/Applications/DBA87511-821F-4D0E-AB22-78FD843BB122/
CuteAlarm.app/wakeup.caf但是通知出现时,依然没有播放这段声音~