title: AVAsset returns audio error even though there is a sound file
body: <p>I do the following which works fine</p>
  <pre><code>let audioCompositionTrack = mixComposition.addMutableTrack(withMediaType: .audio, preferredTrackID: Int32(kCMPersistentTrackID_Invalid))
  
  let blankAudioUrl = Bundle.main.url(forResource: &quot;silence&quot;, withExtension: &quot;wav&quot;)!
  let blankAudio = AVAsset(url: blankAudioUrl)
  let blankAudioTrack = blankAudio.tracks(withMediaType: .audio).first
  
  var audioTrack: AVAssetTrack?
  
  if videoAsset.tracks(withMediaType: .audio).count &gt; 0 {
  
      audioTrack = videoAsset.tracks(withMediaType: .audio).first
  
  } else {
  
      audioTrack = blankAudioTrack
  }
  
  do {
  
      if let audioTrack = audioTrack {
  
          try audioCompositionTrack?.insertTimeRange(myTimeRange, of: audioTrack, at: .zero)
  
      } else {
          print(&quot;audio track is nil&quot;) // never gets hit
      }
  
  } catch let err as NSError {
      print(err.localizedDescription) // never gets hit
  }
  </code></pre>
  <p>But when I had the <em>blankAudioUrl</em>, <em>blankAudio</em>, and <em>blankAudioTrack</em> to a function, the <code>do-try</code> keeps saying <strong>The operation could not be completed</strong>. The odd thing is I put break points on every return line in the function and <code>return nil</code> never gets hit. Inside the <code>do-try</code> the print statement <em>audio track is nil</em> never prints.</p>
  <p>function:</p>
  <pre><code>func useSilentAudioTrack() -&gt; AVAssetTrack? {
      
      guard let blankAudioUrl = Bundle.main.url(forResource: &quot;silence&quot;, withExtension: &quot;wav&quot;) else {
          return nil
      }
  
      let blankAudio = AVAsset(url: blankAudioUrl)
      
      guard let blankAudioTrack = blankAudio.tracks(withMediaType: .audio).first else {
          return nil
      }
      
      return blankAudioTrack // this always returns
  }
  </code></pre>
  <p>use of function in code:</p>
  <pre><code>var audioTrack: AVAssetTrack?
  
  if videoAsset.tracks(withMediaType: .audio).count &gt; 0 {
  
      audioTrack = videoAsset.tracks(withMediaType: .audio).first
  
  } else {
  
      audioTrack = useSilentAudioTrack()
  }
  
  do {
              
      if let audioTrack = audioTrack {
  
          try audioCompositionTrack?.insertTimeRange(myTimeRange, of: audioTrack, at: .zero)
  
      } else {
          print(&quot;audio track is nil&quot;) // never gets hit
      }
  
  } catch let err as NSError {
      print(err.localizedDescription) // Gets hit
  }
  </code></pre>