Search code examples
ioscordovacordova-pluginsibm-mobilefirst

Camera.DestinationType.FILE_URI is not working on IOS only


we have migrated a worklight 6.1 application t IBM mobilefirst 7.0 platform and all the functionalities working as expected on the android environment, but in ios we are facing an issue: there is a function called "quick receipt". on click on a button the device camera opens and a photo is taken. The problem is that the photo is not displaying - it returns complete blank page this issue on ios device only but not on Android device. Camera.DestinationType.FILE_URI is not working on IOS.

for security reason we wont share the code. here is similar prototype code.

html

    <div><img alt="QuickReceipts" src="resources/img/camera.png" onclick="imgCapture();"</div>

JavaScript

    imgCapture: function (){

    navigator.camera.getPicture(this.onSuccess, this.onFail,{quality:80,destinationType:Camera.DestinationType.FILE_URI, targetWidth:600,targetHeight:1050}
    },
    onSuccess:function(imgData)
    {
    // applying the css and displaying the img
  $("#imgReceipt").attr("src","data:image/jpeg;base64," +imgData);
  $("#imgReceipt").css("display", "block");
    }
    onFail:function(imgData){
    // failure msg
    }

Solution

  • One suggestion is to attempt to code change as mentioned by Nazmul: http://www.telerik.com/forums/ios-cordova-3-5-0-camera-getpicture-targetwidth-issue.

    Another suggestion is to upgrade to the latest 7.1 iFix from IBM Fix Central which contains several Cordova corrections and may address your issue.

    If your issue is not resolved still, I suggest to open an IBM PMR (support ticket).