title: merging 2 audio files caf using AVFoundation in iOS 9
body: <p>Hi I am just facing this issue in iOS 9.. I am trying to merge 2 caf files and all was working fine in iOS 8 but when I test app on iOS 9 it is not working expectedly.. only one file played when I play final merged file.. Any kind of help will be appreciatedA</p>
  
  <pre><code>AVMutableComposition *composition = [[AVMutableComposition alloc] init];
  
          AVMutableCompositionTrack *compositionAudioTrack = [composition addMutableTrackWithMediaType:AVMediaTypeAudio preferredTrackID:kCMPersistentTrackID_Invalid];
          [compositionAudioTrack setPreferredVolume:1.0];
          NSURL *url = [NSURL fileURLWithPath:[url3 path]];
          AVAsset *avAsset = [AVURLAsset URLAssetWithURL:url options:nil];
          AVAssetTrack *clipAudioTrack = [[avAsset tracksWithMediaType:AVMediaTypeAudio] objectAtIndex:0];
          [compositionAudioTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, avAsset.duration) ofTrack:clipAudioTrack atTime:kCMTimeZero error:nil];
  
          AVMutableCompositionTrack *compositionAudioTrack1 = [composition addMutableTrackWithMediaType:AVMediaTypeAudio preferredTrackID:kCMPersistentTrackID_Invalid];
          [compositionAudioTrack1 setPreferredVolume:1.0];
          NSURL *url1 = [NSURL fileURLWithPath:[url12 path]];
          AVAsset *avAsset1 = [AVURLAsset URLAssetWithURL:url1 options:nil];
          AVAssetTrack *clipAudioTrack1 = [[avAsset1 tracksWithMediaType:AVMediaTypeAudio] objectAtIndex:0];
          [compositionAudioTrack1 insertTimeRange:CMTimeRangeMake(kCMTimeZero, avAsset1.duration) ofTrack:clipAudioTrack1 atTime:kCMTimeZero error:nil];
  
          AVAssetExportSession *exportSession = [AVAssetExportSession
                                                 exportSessionWithAsset:composition
                                                 presetName:AVAssetExportPresetAppleM4A];
  
          //NSLog(@"Output file path - %@",soundOneNew);
  
          // configure export session  output with all our parameters
          exportSession.outputURL = [NSURL fileURLWithPath:soundOneNew]; // output path
          exportSession.outputFileType = AVFileTypeAppleM4A; // output file type
          // perform the export
  
          NSLog(@"AVAssetExportSessionStatusCompleted");
  
          [exportSession exportAsynchronouslyWithCompletionHandler:^{
  
              if (AVAssetExportSessionStatusCompleted == exportSession.status) {
                  NSData *newAudiofound = [NSData dataWithContentsOfURL:exportSession.outputURL];
                  [newAudiofound writeToFile:[finalURLAudio path] atomically:YES];
                  [self playAudio:exportSession.outputURL];
  
              } else if (AVAssetExportSessionStatusFailed == exportSession.status) {
                  // a failure may happen because of an event out of your control
                  // for example, an interruption like a phone call comming in
                  // make sure and handle this case appropriately
                  NSLog(@"AVAssetExportSessionStatusFailed");
              } else {
                  NSLog(@"Export Session Status: %d", exportSession.status);
              }
          }];
  </code></pre>