我在iphone平台的cordova 2.9.0上运行了一个jqm + phonegap应用程序。
在android上,以下代码有效,但它无法在iOS上运行...
JS:
function getImage() {
navigator.camera.getPicture(uploadPhoto, function(message) {
alert('Get Picture Failed. Please Try Again.');
},{
quality: 50,
destinationType: navigator.camera.DestinationType.FILE_URI,
sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY
}
);
}
function uploadPhoto(imageURI) {
var options = new FileUploadOptions();
options.fileKey="file";
options.fileName=curClub+imageURI.substr(imageURI.lastIndexOf('/')+1);
options.mimeType="image/jpeg";
var params = new Object();
params.value1 = "test";
params.value2 = "param";
params.clubID = curClub ;
options.params = params;
options.chunkedMode = false;
var ft = new FileTransfer();
ft.upload(imageURI, "url", win, fail, options);
}
HTML:
<div data-role = "button" onClick = "getImage();" >Upload Logo</div>
如果我通过在里面添加一个警告测试getImage()函数,它可以工作,所以我知道它会去那里。还有什么我做错了?