|
[多端开发]
apicloud 3 上传图片 闪退
[复制链接]
app上传图片选择图片后 app停止运行 强制退出 ,请问是哪里的问题api.actionSheet({
title: '上传身份证',
cancelTitle: '取消',
buttons: ['拍照', '从手机相册选择']
}, function (ret, err) {
if (ret) {
getPicture(ret.buttonIndex);
}
});
function getPicture(sourceType) {
if (sourceType == 1) { // 拍照
api.getPicture({
sourceType: 'camera',
encodingType: 'jpg',
mediaValue: 'pic',
allowEdit: false,
destinationType: 'url',
quality: 90,
saveToPhotoAlbum: true
}, function (ret, err) {
if (ret) {
alert(JSON.stringify(ret));
} else {
alert(JSON.stringify(err));
}
api.showProgress({
style: 'default',
animationType: 'fade',
text: '图片上传中...',
modal: false
});
if (ret.data == "") {
api.hideProgress();
} else {
// mcmupload(ret.data);
}
});
} else if (sourceType == 2) { // 从相机中选择
api.getPicture({
sourceType: 'library',
encodingType: 'jpg',
mediaValue: 'pic',
destinationType: 'url',
quality: 100,
targetWidth: 200,
targetHeight: 200
}, function (ret, err) {
if (ret) {
alert(JSON.stringify(ret));
} else {
alert(JSON.stringify(err));
}
api.showProgress({
style: 'default',
animationType: 'fade',
text: '图片上传中...',
modal: false
})
if (ret.data == "") {
api.hideProgress();
} else {
// mcmupload(ret.data)
}
});
} else {
return;
}
}
|
-
|