Sulot
Sulot

Reputation: 514

Camera code and Cordova not working

It just driving me crazy why it is not working. It should be very simple.

I added the plugin using the CLI command. I am sure it is a beginner question, but I just don't get it.

Then I have a "button" called "prendrephoto1". When click it should take a picture. But when button click, just nothing happen on the Xcode Ios Simulator. I use JqueryMobile and Cordova.

    $(document).ready(function(){
var photo1;
var photo2;

$("#prendrephoto1").bind("click",prendrephoto);


function prendrephoto(){

navigator.camera.getPicture(onSuccess, onFail, { quality: 50,
    destinationType: Camera.DestinationType.DATA_URL
});

function onSuccess(imageData) {
    var image = document.getElementById('myImage');
    image.src = "data:image/jpeg;base64," + imageData;
}

function onFail(message) {
    alert('ca ne marche pas');
    alert('Failed because: ' + message);
}

};

//DERNIERE BALISE JQUERY
});

Upvotes: 1

Views: 92

Answers (1)

Mike Dailor
Mike Dailor

Reputation: 1266

The iOS simulator does not provide capture simulation, you'll need to run your app on an actual device to retrieve a picture from the camera.

Upvotes: 1

Related Questions