回答編集履歴
2
try!!!!!
test
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
do {
|
6
6
|
|
7
|
-
let audioPlayer = AVAudioPlayer(contentsOfURL: pianoSoundURL)
|
7
|
+
let audioPlayer = try AVAudioPlayer(contentsOfURL: pianoSoundURL)
|
8
8
|
|
9
9
|
audioPlayer.prepareToPlay()
|
10
10
|
|
1
例外処理追加
test
CHANGED
@@ -2,8 +2,20 @@
|
|
2
2
|
|
3
3
|
```swift
|
4
4
|
|
5
|
+
do {
|
6
|
+
|
5
|
-
let audioPlayer = AVAudioPlayer(contentsOfURL: pianoSoundURL)
|
7
|
+
let audioPlayer = AVAudioPlayer(contentsOfURL: pianoSoundURL)
|
8
|
+
|
9
|
+
audioPlayer.prepareToPlay()
|
10
|
+
|
11
|
+
audioPlayers.append(audioPlayer)
|
12
|
+
|
13
|
+
} catch {
|
14
|
+
|
15
|
+
print("error")
|
16
|
+
|
17
|
+
}
|
6
18
|
|
7
19
|
```
|
8
20
|
|
9
|
-
|
21
|
+
|