題名の通り、ローカル通知の効果音を自分の音源にしたいのですが、下のコードでは普通のピロリンという音しか流れません。音源ファイルの場所は、プログラムと同階層の所にあります。
Swift2
1 func applicationDidEnterBackground(application: UIApplication) {//ホームに戻る 2 // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 3 // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 4 //ローカル通知 5 todayMedicines = realm.objects(TodayMedicine).sorted("time", ascending: true) 6 for i in 0..<todayMedicines.count { 7 let notification = UILocalNotification() 8 //ロック中にスライドで〜〜のところの文字 9 notification.alertAction = "アプリを開く" 10 //通知の本文 11 notification.alertBody = "\(todayMedicines[i].name)を飲みましょう" 12 //通知される時間 13 notification.fireDate = NSDate(timeIntervalSinceNow: 10) 14 //通知音 15 notification.soundName = "voice.m4a" 16 //アインコンバッジの数字 17 notification.applicationIconBadgeNumber += 1 18 //通知をスケジューリング 19 application.scheduleLocalNotification(notification) 20 } 21 }
設定する方法を知っている方がいたら、ご回答お願いします。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/08/21 02:03
2016/08/21 12:39
2016/08/21 12:43