我将 PhoneGap 2.9.0 与我的 iPhone 应用程序的 Camera API 一起使用。当我调用该方法时,它不起作用。这是我的代码:
应用程序/支持文件/Cordova.plist
<key>Plugins</key>
<dict>
<key>Camera</key>
<string>CDVCamera</string>
</dict>
配置文件
<plugin name="Camera" value="CDVCamera" />
关于捕获方法
function capturePhoto() {
navigator.camera.getPicture(onPhotoURISuccess, fail, {
quality: 50,
destinationType: Camera.DestinationType.FILE_URI
});
}
function onPhotoURISuccess(imageURI) {
Ext.Viewport.setMasked({
xtype: 'loadmask',
message: 'Loading..',
indicator: true
});
var options = new FileUploadOptions();
options.fileKey = "file";
options.fileName = imageURI.substr(imageURI.lastIndexOf('/') + 1);
options.mimeType = "image/jpeg";
var params = new Object();
params.value1 = "Fastabuy";
options.params = params;
options.chunkedMode = false;
var URL = imguploadurl + 'pid=&type=single';
//console.log(URL);
var ft = new FileTransfer();
ft.upload(imageURI, URL, win, fail, options);
/*attendphoto=imageURI;
document.getElementById('productpic').src = attendphoto;
App.gvars.Productimg=attendphoto;
//console.log( App.gvars.Productimg);*/
}
var captureSuccess = function (mediaFiles) {
for (i = 0, len = mediaFiles.length; i < len; i += 1) {
fpath = mediaFiles[i].fullPath;
fimage = mediaFiles[i].name;
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotimg, fail);
}
};
我不知道我的代码有什么问题。请帮我整理一下。