Post not yet marked as solved
Click to stop watching this thread.
You have stopped watching this post. Click to start watching again.
contentPostList.repliesup-voted.tooltip
Replied In
Thread 1: EXC_BAD_ACCESS
I did some research and found the solution courtesy to Ray Wenderlich and Co. by creating an non-optional var and func with string parameter:Import SpriteKitImport GameplayKitImport AVFoundationclass GameViewController: UIViewController {var backgroundAudio = AVAudioPlayer!override func viewDidLoad() {super.viewDidLoad()playBackgroundAudio(audioname: “MySong.wav”)}//vDLfunc playBackgroundAudio(audioname: String) {let urlPath = Bundle.main.url(forResource: audioname, withExtension: nil)guard let url = urlPath else {print(“Could not find file: \(audioname)”)return}do {try backgroundAudio = AVAudioPlayer(contentsOf: url)backgroundAudio.numberOfLoops = -1backgroundAudio.volume = 0.7background.play()}catch {print(“Cannot Find The Audio”)return}}//func}//ClassGVCBut I still don’t understand why the old code stopped working when Xcode updated.