title: unable to record and save audio in ionic app on IOS
body: <p>i am making an ionic app which records the audio and stores it to the persistent location, while it is working perfectly on Android, IOS is making me go crazy.</p>
  
  <p>here is the code i am using</p>
  
  <p>Code for creating directory</p>
  
  <pre><code>if (ionic.Platform.isAndroid()) {
    console.log('ok..its android. setting base dir path');
    $rootScope.dirBasePath = cordova.file.externalRootDirectory;
  } else if (ionic.Platform.isIOS()) {
    console.log('it is ios, setting base path');
    $rootScope.dirBasePath = cordova.file.dataDirectory;
  }
  
  console.log($rootScope.dirBasePath);
  // create directory for audio recordings
  $cordovaFile.createDir($rootScope.dirBasePath, "corrit", false)
  .then(function (success) {
    console.log('created dir '+JSON.stringify(success));
  }, function (error) {
    console.log('error creating dir '+JSON.stringify(error));
  });
  </code></pre>
  
  <p>directory is being created successfully on both platforms</p>
  
  <p>here is the code for recoding audio file</p>
  
  <pre><code>timestamp = new Date()
  if (ionic.Platform.isAndroid()) {
      $scope.audioFileName = timestamp.getTime()+'.amr';
  } else if (ionic.Platform.isIOS()) {
      $scope.audioFileName = timestamp.getTime()+'.wav';
  }
  $scope.data.audioSrc = $rootScope.dirBasePath+'corrit/'+$scope.audioFileName;
  console.log($scope.data.audioSrc);
  $scope.data.media = $cordovaMedia.newMedia($scope.data.audioSrc);
  
  console.log('recording audio...');
  $scope.data.media.startRecord();
  </code></pre>
  
  <p>here is the code for playing audio file</p>
  
  <pre><code>console.log('stoping audio...');
  $scope.data.media.stopRecord();
  $scope.data.media.play();
  </code></pre>
  
  <p>here are the console log for ios</p>
  
  <pre><code>created dir {"isFile":false,"isDirectory":true,"name":"corrit","fullPath":"/corrit/","filesystem":"&lt;FileSystem: library-nosync&gt;","nativeURL":"file:///var/mobile/Containers/Data/Application/C07AA015-63B3-4B10-8032-08B0352F06F0/Library/NoCloud/corrit/"}
  
  record audio
  file:///var/mobile/Containers/Data/Application/C07AA015-63B3-4B10-8032-08B0352F06F0/Library/NoCloud/corrit/1450348328418.wav
  recording audio...
  THREAD WARNING: ['Media'] took '575.528076' ms. Plugin should use a background thread.
  exeption nativeEvalAndFetch : TypeError: undefined is not an object (evaluating 'a.reject')
  stoping audio...
  Failed to initialize AVAudioPlayer: The operation couldn’t be completed. (OSStatus error 2003334207.)
  THREAD WARNING: ['Media'] took '18.506104' ms. Plugin should use a background thread.
  </code></pre>
  
  <p>my guess is that file is not being record that the specified path</p>
  
  <p>what is wrong?</p>
  
  <p>Thanks</p>