问题描述:

What is the easiest library / framework to use?

I see lots of libraries but don't know which the industry standard is.

网友答案:

Here is some working Code for you to make it simpler. This works perfectly in my game.

import AVFoundation

var bgMusic:AVAudioPlayer = AVAudioPlayer()

override func viewDidLoad() {
    super.viewDidLoad()

var bgMusicURL:NSURL = NSBundle.mainBundle().URLForResource("yourTune", withExtension: "mp3")!
bgMusic = AVAudioPlayer(contentsOfURL: bgMusicURL, error: nil)
bgMusic.numberOfLoops = 1
bgMusic.prepareToPlay()
bgMusic.play()

}

Make sure to change the name of your tune! :)

网友答案:

You don't need an additional library to play sounds in iOS. Just use what is provided to you by the corresponding SDK: AVAudioPlayer.

相关阅读:
Top