Ionic image selector and picker is not working in IOS

I am trying to select image from image gallery and upload into server but unfortunately its not working in some case.

I have tried cordova-plugin-camera to select picture from device I tried with below method.

But when I select this some time its working fine and some time its throw error:

Cannot read property 'getPicture' of undefined

So now I tried it with different plugin which in cordova-imagePicker

  .then(function (results) {
  for (var i = 0; i < results.length; i++) {
console.log('Image URI: ' + results[i]);
}, function(error) {
// error getting photos

Its also doing the same thing sometime working fine in device and sometime throwing error:

Undefined is not an object(evaluating 'n.imagePicker.getPicture')

I tried with same solution some time its fine but some time its throwing error

Thanks in advance.