gpt4 book ai didi

android - navigator.camera.getPicture 不调用成功回调 - ionic framework - cordova

转载 作者:行者123 更新时间:2023-11-29 17:44:49 25 4
gpt4 key购买 nike

我正在使用 navigator.camera 拍照。大多数时候不会调用成功和错误回调。我已经安装了cordova相机插件

我正在使用

ionic 1.2.8

Cordova 3.5.0-0.2.7

org.apache.cordova.camera 0.3.3 “相机”

下面显示的是我使用的代码。

$scope.takePicture =  function takePicture()    {
var success = function onSuccess (FILE_URI){
console.log("something" + FILE_URI)
console.log(FILE_URI);
$localstorage.setObject("file",FILE_URI);
$rootScope.picData = FILE_URI;
}

var error = function onError () {
console.log("Error")
alert("error")
}

console.log("Taking picture");
navigator.camera.getPicture(success,error,{
quality: 50,
destinationType: navigator.camera.DestinationType.FILE_URI,
sourceType: navigator.camera.PictureSourceType.CAMERA
});

};

最佳答案

当我断开手机与系统的连接后,它开始完美运行。当我的手机处于开发者模式时出现了错误。

下面给出的几个链接可能会帮助其他面临类似问题的人

PhoneGap camera restarts the application

How to prevent Android to restart application after calling camera intent?

Cordova / Samsung Galaxy SIII - Camera Crashes app

Phonegap camera android kills cordova

Cordova plugin callback received after second plugin call

将其张贴在这里,以便对其他人有所帮助。 :)

关于android - navigator.camera.getPicture 不调用成功回调 - ionic framework - cordova,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27404748/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com