Вот код, который я использую. Всякий раз, когда код достигал предупреждения, он распечатал 20, да, целое число < /p>
Код: Выделить всё
async function getURIFromCamera(source = 1) {
return new Promise((resolve, reject) => {
if (!navigator.camera) {
console.error('Camera plugin is not available')
alert('Camera plugin is not available')
reject(new Error('Camera plugin not available'))
return
}
const camera = navigator.camera
const options = {
quality: 50,
sourceType: source,
destinationType: camera.DestinationType.FILE_URI,
encodingType: camera.EncodingType.JPEG,
mediaType: camera.MediaType.PICTURE,
saveToPhotoAlbum: true,
correctOrientation: true
}
function showError (error) {
console.error('Camera error:', error)
alert('Camera error: ' + error)
reject(error)
}
camera.getPicture(
imageURI => {
alert(imageURI)
resolve(imageURI)
},
showError,
options
)
})
}
< /code>
И вот мой манифест: < /pbr />
Подробнее здесь: https://stackoverflow.com/questions/797 ... returns-20
Мобильная версия