【发布时间】:2016-07-01 23:47:27
【问题描述】:
我正在尝试上传图片。以前,它一切正常。突然间,它停止在 Android 上运行。在 iOS 上测试了相同的代码,运行良好。
用例: 1. 单击一个按钮 - 打开相机(或从图库中选择) 2. 捕捉图像 3. 按“确定”按钮 - 应用程序崩溃
我清除了很多内存,认为某些设备可能存在内存问题。根据新的发行说明添加了相机权限,仍然面临问题。这是我的代码:
var dialog = Ti.UI.createOptionDialog({
options : ['Camera', 'Gallery', 'Cancel'],
title : 'Upload image using?'
});
dialog.show();
dialog.addEventListener('click', function(e) {
if (e.index === 0) {
//Open Camera
Ti.Media.showCamera({
saveToPhotoGallery : true,
success : function(event) {
console.error('UPLOAD IMAGE SUCCESS ', JSON.stringify(event));
callback(event.media);
},
cancel : function(err) {
console.error('UPLOAD IMAGE CANCEL ', JSON.stringify(err));
},
error : function(err) {
console.error('UPLOAD IMAGE ERROR ', JSON.stringify(err));
},
showControls : true,
mediaTypes : Ti.Media.MEDIA_TYPE_PHOTO,
autohide : true
});
} else if (e.index === 1) {
//Open gallery
Ti.Media.openPhotoGallery({
success : function(event) {
console.error('UPLOAD IMAGE SUCCESS ', JSON.stringify(event));
callback(event.media);
},
cancel : function(err) {
console.error('UPLOAD IMAGE CANCEL ', JSON.stringify(err));
},
error : function(err) {
console.error('UPLOAD IMAGE ERROR ', JSON.stringify(err));
},
});
} else {
// Do nothing
}
dialog.hide();
});
tiapp.xml
<manifest>
<uses-permission android:name="android.permission.CAMERA" />
</manifest>
谁能告诉我代码有什么问题或者我需要添加什么吗?
一些日志:
[DEBUG] : skia: --- SkImageDecoder::Factory returned null
[DEBUG] : skia: --- SkImageDecoder::Factory returned null
[DEBUG] : skia: --- SkImageDecoder::Factory returned null
[DEBUG] : skia: --- SkImageDecoder::Factory returned null
[DEBUG] : skia: --- SkImageDecoder::Factory returned null
[DEBUG] : Window: Window is closed normally.
【问题讨论】:
-
你能发布你的Logcat吗..
-
崩溃时我没有得到任何调试日志。
-
添加了一些我在崩溃前得到的日志
标签: android titanium android-camera titanium-mobile