Swift3.0でiOS10のUser Notifications framework(UserNotifications)を用いてローカル通知を実装しようとしています。
通知の許可を得る処理は問題なく動いていて、通知音がデフォルトだと問題なく実行されるのですが、以下の様に任意のサウンドを鳴らそうとしても、デフォルトの通知音が鳴ってしまいます。
swift
1let content = UNMutableNotificationContent() 2content.title = "通知音が" 3content.body = "デフォルトになる" 4// soundName.wavは29秒で、フォーマットはリニアPCMです。 5content.sound = UNNotificationSound.init(named: "soundName.wav") 6let trigger = UNTimeIntervalNotificationTrigger.init(timeInterval: 5, repeats: false) 7let request = UNNotificationRequest.init(identifier: "AlarmNotification", content: content, trigger: trigger) 8let center = UNUserNotificationCenter.current() 9center.add(request)
よろしくお願いします。
回答1件
あなたの回答
tips
プレビュー