Cordova/phonegap iOS plugin file picker issue

0

i’m developping an Ionic3 App and wants to allow user to upload files from their devices. I’ve got an issue with cordova/phonegap file picker plugin. I followed the instructions here :

But even using the simplest code which is given in Ionic documentation doesn’t work :

import { IOSFilePicker } from '@ionic-native/file-picker/ngx';

constructor(private filePicker: IOSFilePicker) { }

this.filePicker.pickFile()
  .then(uri => console.log(uri))
  .catch(err => console.log('Error', err));

I keep on getting this error :

ERROR Error: Uncaught (in promise): TypeError: Object(...) is not a function
TypeError: Object(...) is not a function
    at IOSFilePicker.pickFile (index.js:27)

The plugin has been correctly installed in app.module.ts with the correct ngx path.

Here some additional info about versions :

  • ionic framework : 3.9.2
  • Ionic App Scripts: 3.1.8
  • Angular Core: 6.0.3
  • Angular Compiler CLI: 6.0.3
  • Node: 8.11.3
  • @ionic-native/file-picker: 5.4.0
  • rxjs: 6.3.3
  • typescript: 2.7.2

any idea ?

Thx

Problem solved.

It had to do with plugin not working on 5.X.X with ionic 3.

You have to downgrade it to 4.X.X.