I'm trying to add sound to an iOS app that I am writing. I keep getting the error message "Incorrect argument label in call (have 'contentsOfURL:error:', expected "contentsOfURL:fileTypeHint:')". I have tried tinkering with it in several ways, and I can't get it to build. Here is my code:
import UIKit import AVFoundation
class ViewController: UIViewController {
var Setup = NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("DMSetup", ofType: "mp3")!) var audioPlayer = AVAudioPlayer() override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. audioPlayer = AVAudioPlayer(contentsOfURL: Setup, error: nil) audioPlayer.prepareToPlay() } override func didReceiveMemoryWaing() { super.didReceiveMemoryWaing() // Dispose of any resources that can be recreated. } @IBAction func PlayKeySetup(sender: UIButton) { audioPlayer.play() }}
Any suggestions? I'm a newbie at this, so I'm sure I'm missing something obvious. xCode 7.3.1, OSX 10.11.4
Thanks.
