我一直在同一个问题上停留了一段时间,我希望有人能够提供帮助。UILocalNotification声音不能在设备上播放
我创建了一个闹钟应用程序,它使用UILocalNotification在选定时间播放闹钟声音。
我的应用程序在模拟器上工作正常,但是当我开始在iPhone上测试时,通知声音停止振铃。
我在.caf中有声音,长约20秒,正确的大小写和一切,所以我真的不知道为什么它不响。我在应用程序的其他地方使用相同的声音文件,并且它工作正常,所以我确实知道该文件已正确加载。 通知正常显示,没有声音。是的,我确定了我的iPhone上的音量。
有没有人知道为什么会发生这种情况? 以下是我的代码。
预先感谢您! -Ema
UILocalNotification* alarm = [[ULocalNotification alloc] init];
alarm.fireDate = pickedDate;
alarm.timeZone = [NSTimeZone defaultTimeZone];
alarm.hasAction = YES;
alarm.alertAction = @"SNOOZE";
alarm.repeatInterval = 0;
alarm.soundName = @"Alarm11.caf";
alarm.alertBody = @"Alarm";
[app scheduleLocalNotification:alarm];
我读过,你的声音音量调高了,但只是要确定:静音按钮处于关闭状态? – marcus
是的,一旦应用程序启动,所有的声音按预期工作。这只是UILocalNotification声音。 – emama
默认声音工作正常,我认为? (UILocalNotificationDefaultSoundName) – marcus