Cordova iOS - can't record sound even though the file is created

I am trying to record a sound file using cordova-plugin-media, but I am always getting this error:

{message: “Failed to initialize AVAudioRecorder: (null)↵”, code: 1}

I am first creating the file, like this

iOSCreateFile(fileName, callback) {
    window.requestFileSystem(LocalFileSystem.TEMPORARY, 0, (fs) => {
        fs.root.getFile(fileName, {
            create: true, 
            exclusive: false
        }, (fileEntry) => {
            console.log("fileEntry is file?" + fileEntry.isFile.toString());
            // here I am getting true, so the file is obviously created
        }, (error) => {
            console.log('error create file: ' + error);
    }, (error) => {
        console.log('error loading file system: ' + error);

The fileEntry.nativeURL I am sending back looks like this


then, when this calls back, I am doing the following

// that long file path string is passed here
let soundRecord = new Media(filePath, () => {
    // success
    // more code
}, (error) => {

And once it tries to execute the startRecord(), it gives me the Failed to initialize AVAudioRecorder error…
I also tried not creating a file, but only passing a file name string to the new Media object, like “1240215251.wav”, and it’s supposed to create it for me, but I am still getting the same error.

What am I doing wrong please?

Please post solution if you found it