Phonegap navigator.camera.getPicture内存警告

时间:2014-05-17 09:00:37

标签: javascript cordova phonegap-plugins

每次我使用phonegap API函数在iOS上创建图像时,点击使用照片后,我会收到警告。 (内存使用率达到约60MB)

我的代码:

navigator.camera.getPicture(onSuccess, onFail, { quality: 20 });

function onSuccess(imageData) {
    console.log('succ');
}

function onFail(message) {
    alert('Failed because: ' + message);
}

警告:

2014-05-17 10:56:35.122 Cityfe[1845:60b] Received memory warning.
2014-05-17 10:56:35.195 Cityfe[1845:60b] succ

这有什么值得担心的吗?

1 个答案:

答案 0 :(得分:3)

尝试这个

function getPhoto(source) {
    // Retrieve image file location from specified source
    navigator.camera.getPicture(onSuccess, onFail, {
        quality: 30,
        targetWidth: 600,
        targetHeight: 600,
        destinationType: navigator.camera.DestinationType.FILE_URI,
        correctOrientation: true,
        sourceType: source
    });
}

function onSuccess(imageData) {
    console.log('succ');
}

function onFail(message) {
    alert('Failed because: ' + message);
}