ダウンロードしたオーディオにローカル通知音を設定しようとしています。 しかし、通知トリガがサウンドが再生されないとき。私はどこが間違っているのか分かりません。コードを見て、私の間違いを知らせてください。NSダウンロードでダウンロードしたサウンドが再生されない
func setNotificationWithDate(date: NSDate, onWeekdaysForNotify: [Int], snooze: Bool, soundName: String, title: String, vibrate: Bool) {
let AlarmNotification: UILocalNotification = UILocalNotification()
AlarmNotification.alertBody = title
AlarmNotification.alertAction = "Open App"
AlarmNotification.category = "AlarmCategory"
AlarmNotification.timeZone = NSTimeZone.defaultTimeZone()
let datesForNotification = correctDate(date, onWeekdaysForNotify:onWeekdaysForNotify)
for d in datesForNotification
{
AlarmNotification.fireDate = d
let tracksDic = appDelegate().alarmTrackArray.objectAtIndex(d.dayOfWeek()!)
let sound = tracksDic.valueForKey("t_id") as? String
AlarmNotification.soundName = sound! + ".mp3"
print(AlarmNotification.soundName)
let userInfo = ["date":date,"soundDetail":tracksDic,"title":title ,"vibrate":vibrate]
AlarmNotification.userInfo = userInfo
print(AlarmNotification.soundName)
UIApplication.sharedApplication().scheduleLocalNotification(AlarmNotification)
}
}
デバイスがサイレントモードまたはDNDモードでないことを確認します。 –
デバイスがサイレントモードではありません。私のアプリにあらかじめ追加しておいたサウンドでうまく動作します。 –