Мои локальные уведомления работают, и появляется предупреждение, однако звук не воспроизводится. Я тестирую устройство, поскольку я знаю, что он не будет играть в симуляторе.iOS Локальные уведомления - звук не воспроизводится
let notificationAlert = UILocalNotification()
класс DailyAlarmViewController: UIViewController {
@IBOutlet weak var timePicker: UIDatePicker!
@IBAction func alarmSetButton(sender: AnyObject) {
notificationAlert.fireDate = timePicker.date
notificationAlert.timeZone = NSTimeZone.defaultTimeZone()
notificationAlert.repeatInterval = NSCalendarUnit.Day
notificationAlert.alertAction = "Open Survive to Thrive Nation!"
notificationAlert.alertBody = "Time to wake up and complete your Journal!"
notificationAlert.soundName = "Alarm_Clock.wav"
UIApplication.sharedApplication().scheduleLocalNotification(notificationAlert)
}
@IBAction func cancelAlarm(sender: AnyObject) {
UIApplication.sharedApplication().cancelLocalNotification(notificationAlert)
}
Мне нужно добавить фоновый режим или Inter App Аудио ли? Любые мысли были бы оценены.
Вы добавили в свой звуковой файл с ресурсами проекта? Он не будет воспроизводить звук, если ваше приложение не сможет найти файл. – NSGangster