0
下面是一些代码。报警iPhone SDK的发布
UIApplication *app = [UIApplication sharedApplication];
NSArray *oldNotifications = [app scheduledLocalNotifications];
if ([oldNotifications count] > 0) [app cancelAllLocalNotifications];
NSString *filePath = [DOCUMENTS stringByAppendingPathComponent:@"personal2.wav"];
//NSLog(@"%@",filePath);
//filePath = [[NSBundle mainBundle] pathForResource:@"wolf" ofType:@"wav"];
UILocalNotification *localNotif = [[UILocalNotification alloc]init];
localNotif.fireDate = alarmPicker.date ;
localNotif.timeZone = [NSTimeZone localTimeZone];
localNotif.alertBody = @"Alarm";
localNotif.alertAction = @"View";
localNotif.soundName = filePath;
localNotif.applicationIconBadgeNumber = 1;
//localNotif.repeatInterval = NSYearCalendarUnit;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotif];
[localNotif release];
因此,它只显示警报,但它不播放wav。当我点击查看它启动应用程序,并在didReceiveLocalNotification方法我再次播放这首歌曲,听起来不错。 有人可以帮我解决问题。谢谢
P.S.我读WAV的是持续时间应该莱超过30秒,它为22秒钟,这样应该发挥 P.S.2它是一种方法,重复播放歌曲时localnotifications火起来。感谢
肯定。我拥有它。但它不工作 – 2012-02-13 20:05:33
检查'UILocalNotificationDefaultSoundName'工作好。如果是这样,你需要准备你的声音 - 用它转换成''.caf' afconvert'这样的:'在/ usr/bin中/ afconvert -f卡福-d LEI16 {INPUT} {OUTPUT}'。 – 2012-02-14 07:22:50