Ich mache eine apps mit Appcelerator (Titanium SDK). und ich habe ein Problem, wenn ich die Kamera öffne, habe ich bereits Kamera-Erlaubnis in tiapp.xml gesetzt. Und ich habe versucht, eine Quelle aus Küche Waschbecken Titan zu verwenden.Appcelerator Android Kamera immer Anwendung Kraft schließen
Hier ist mein Code
var win;
function fireUpTheCamera() {
if (Ti.Platform.osname === 'android'|| Ti.Platform.osname == "iphone" || Ti.Platform.osname == 'ipad') {
win.removeEventListener('focus', fireUpTheCamera);
}
Titanium.Media.showCamera({
success:function(event) {
var cropRect = event.cropRect;
var image = event.media;
Ti.API.debug('Our type was: '+event.mediaType);
if(event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO)
{
var imageView = Ti.UI.createImageView({
width:win.width,
height:win.height,
image:event.media
});
win.add(imageView);
}
else
{
alert("got the wrong type back ="+event.mediaType);
}
},
cancel:function() {
},
error:function(error) {
// create alert
var a = Titanium.UI.createAlertDialog({title:'Camera'});
// set message
if (error.code == Titanium.Media.NO_CAMERA)
{
a.setMessage('Please run this test on device');
}
else
{
a.setMessage('Unexpected error: ' + error.code);
}
// show alert
a.show();
},
saveToPhotoGallery:true,
allowEditing:true,
mediaTypes:[Ti.Media.MEDIA_TYPE_PHOTO]
});
}
function cam_basic(_args) {
win = Titanium.UI.createWindow({
title:_args.title
});
if (Ti.Platform.osname === 'android'|| Ti.Platform.osname == "iphone" || Ti.Platform.osname == 'ipad') {
win.addEventListener('focus', fireUpTheCamera);
} else {
fireUpTheCamera();
}
return win;
};
module.exports = cam_basic;
wenn ich capture Bild beenden und drücken Sie die OK-Taste, es ist immer neu starten Anwendung ohne Fehlermeldung, auch im Protokoll.
Ich benutze SDK 6.0.0GA.
Bitte geben Sie mir Hilfe und was ist falsch mit meinem Code.
wenn Code im Rückruf entfernt wird, funktioniert es noch? –
@RenePot Ich habe versucht, den Rückruf zu entfernen, und immer noch zwingen, ohne einen Fehler zu schließen. –