title: `audioPlayerDidFinishPlaying` Not Being Called
body: <p>Having an issue where <code>audioPlayerDidFinishPlaying</code> isn't getting called...</p>
  
  <p>I've looked at some other SO threads:</p>
  
  <p><a href="https://stackoverflow.com/questions/33707462/swift-audioplayerdidfinished-will-not-be-called">Swift: AudioPlayerDidFinished will not be called</a></p>
  
  <p><a href="https://stackoverflow.com/questions/28781684/avaudioplayerdelegate-doesnt-call-the-method">AVAudioPlayerDelegate doesn&#39;t call the method</a></p>
  
  <p>...but still having the same issue.</p>
  
  <p>I've set my <code>ViewController</code> to conform to <code>AVAudioPlayerDelegate</code>:</p>
  
  <pre><code>class ViewController: UIViewController, AVAudioPlayerDelegate {
  var audioEngine = AVAudioEngine()
  ...
  }
  </code></pre>
  
  <p>And create the player here; setting the delegate right after creating the player itself:</p>
  
  <pre><code>func startAudioEngine(audioFileURL: URL) {
  
      var player: AVAudioPlayer?
  
      do {
          try AVAudioSession.sharedInstance().setCategory(.playback, mode: .default)
          try AVAudioSession.sharedInstance().setActive(true)
  
          player = try AVAudioPlayer(contentsOf: audioFileURL, fileTypeHint: AVFileType.mp3.rawValue)
  
          guard let player = player else { return }
          player.delegate = self
  
          player.prepareToPlay()
          player.play()
  
      } catch let error {
          print(error.localizedDescription)
      }
  }
  </code></pre>