teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

2

変更

2019/01/23 01:54

投稿

hahum
hahum

スコア65

answer CHANGED
@@ -1,4 +1,17 @@
1
- takabosoftさんの
1
+ takabosoftさんのご回答
2
2
  try! AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryAmbient, mode: .default)
3
3
 
4
- で解決することができました。ありがとうございます。
4
+ で解決することができました。ありがとうございます。
5
+ ```swift4
6
+ func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
7
+ //バックグラウンドで音楽再生
8
+ do {
9
+ try! AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryAmbient, mode: .default)
10
+ } catch {
11
+ print(error)
12
+ }
13
+
14
+
15
+ return true
16
+ }
17
+ ```

1

k

2019/01/23 01:54

投稿

hahum
hahum

スコア65

answer CHANGED
@@ -1,3 +1,4 @@
1
+ takabosoftさんの
1
- https://qiita.com/taka000826/items/2188f8f20e31af11efce
2
+ try! AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryAmbient, mode: .default)
2
3
 
3
- を参考にして同時再生することができました。
4
+ で解決することができました。ありがとうございます。