title: ionic Cordova Failed recording audio on IOS using Media plugin
body: <p>i'm working on an ionic App and i need to record audio files , so i used the cordova-plugin-media , it worked fine for android but when i tried it on ios i get this error :</p>
  
  <blockquote>
    <p>{"message":"Failed to start recording using AVAudioRecorder","code":1}</p>
  </blockquote>
  
  <p>here is my code :</p>
  
  <pre><code>var extension = '.wav';
  var name = 'filename';
  var audio = null;
  var filepath;
  
  $scope.startRecording = function() {
    name = Utils.generateFilename();
    if(device.platform == "iOS")
    {
       //var path = "documents://";
       //var path = cordova.file.documentsDirectory;
       //var path = cordova.file.cacheDirectory;
       var path = cordova.file.dataDirectory;
       path = path.replace("file:///", "cdvfile://");
  
    }
    else if(device.platform == "Android")
    {
      var path = cordova.file.externalApplicationStorageDirectory;
    }
    var filename = name + extension;
    filepath = path + filename;
    audio = new Media(filepath, function(e){console.log(e, "success Media");},function(e){console.log(e, "error");});
      audio.startRecord();
  
    };
  
    $scope.sendAudioMsg = function() {
       audio.stopRecord();
       audio.release();
    };
  </code></pre>
  
  <p>when i console log the path i get this :</p>
  
  <blockquote>
    <p>cdvfile://var/mobile/Containers/Data/Application/F47A76AD-E776-469F-8EFA-85B0A0F14754/Library/NoCloud/dJzSapEU6k16hV7EGrD06L29NjZcOCVzHCUTrcjEDiTCF7uUNGmCHchEcwfGls3V88p85ij0NUkv0KVagevbgh3lwWsEfmAO8uNq.wav</p>
  </blockquote>
  
  <p>can any one help me??</p>