嗯,发出本地通知,一切都很好,但即使我将声音名称属性设置为默认通知声音名称,也没有声音。 P.S:声音在模拟器和设备上都不起作用。
这是我的代码..
UILocalNotification *aNotification = [[UILocalNotification alloc] init];
aNotification.timeZone = [NSTimeZone defaultTimeZone];
aNotification.alertBody = _reminderTitle.text;
aNotification.alertAction = @"Show me!";
aNotification.soundName = UILocalNotificationDefaultSoundName;
aNotification.applicationIconBadgeNumber += 1;
[[UIApplication sharedApplication] scheduleLocalNotification:aNotification];
有什么想法吗? :)
最佳答案
您的模拟器可能已静音。
转到系统偏好设置 -> 声音 -> 音效 -> 选中“播放用户界面音效”
关于ios - UILocalNotifications 触发时没有声音,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21867110/