title: AVAudioPlayer not playing audio in Swift
body: <p>I have this code in a very simple, single view Swift application in my <code>ViewController</code>:</p>
  
  <pre><code>var audioPlayer = AVAudioPlayer()
  
  @IBAction func playMyFile(sender: AnyObject) {
  
      let fileString = NSBundle.mainBundle().pathForResource("audioFile", ofType: "m4a")
      let url = NSURL(fileURLWithPath: fileString)
      var error : NSError?
      audioPlayer = AVAudioPlayer(contentsOfURL: url, error: &amp;error)
      audioPlayer.delegate = self
      audioPlayer.prepareToPlay()
      if (audioPlayer.isEqual(nil)) {
          println("There was an error: (er)")
      } else {
          audioPlayer.play()
          NSLog("working")
      }
  </code></pre>
  
  <p>I have added <code>import AVFoundation</code> and <code>audioPlayer</code> is a global variable. When I execute the code, it does print "working", so it makes it through without errors but no sound is played. The device is not in silent.</p>