ローカルの通知が機能していて、アラートが表示されていますが、サウンドは再生されていません。私はそれがシミュレータで再生されません知っているように私はデバイス上でテストしています。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)
}
は、私がバックグラウンドモードまたはインターアプリのオーディオを追加する必要がありますか?いかなる考えも認められるだろう。
サウンドファイルをプロジェクトリソースにバンドルして追加しましたか?あなたのアプリがファイルを見つけることができない場合、サウンドは再生されません。 – NSGangster