这个问题得到解决了吗。我这也是相同型号的手机和微信版本号调用前置摄像头会出现闪退
多次调用camera微信会崩溃WXML: [代码]<[代码][代码]camera[代码] [代码]wx:if[代码][代码]=[代码][代码]"{{camera}}"[代码] [代码]style[代码][代码]=[代码][代码]"height:400rpx;width:400rpx;left:50%; top:50%;margin-left:-200rpx;margin-top:-300rpx"[代码] [代码]device-position[代码][代码]=[代码][代码]"front"[代码] [代码]flash[代码][代码]=[代码][代码]"off"[代码] [代码]binderror[代码][代码]=[代码][代码]"error"[代码] [代码]id[代码][代码]=[代码][代码]"myCamera"[代码][代码]></[代码][代码]camera[代码][代码]>[代码][代码]<[代码][代码]cover-view[代码] [代码]class[代码][代码]=[代码][代码]"cover"[代码] [代码]hidden[代码][代码]=[代码][代码]"{{open}}"[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]cover-view[代码] [代码]class[代码][代码]=[代码][代码]"confirm"[代码] [代码]hidden[代码][代码]=[代码][代码]"{{!confirm_btn_visible}}"[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]cover-image[代码] [代码]src[代码][代码]=[代码][代码]"../../common/image/confirm.png"[代码] [代码]mode[代码][代码]=[代码][代码]'widthFix'[代码] [代码]/>[代码][代码] [代码][代码]<[代码][代码]cover-view[代码] [代码]class[代码][代码]=[代码][代码]"msg"[代码][代码]>人脸识别成功</[代码][代码]cover-view[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]cover-view[代码] [代码]class[代码][代码]=[代码][代码]"bottom_btn"[代码] [代码]bindtap[代码][代码]=[代码][代码]"confirm"[代码][代码]>确认</[代码][代码]cover-view[代码][代码]>[代码][代码] [代码][代码]</[代码][代码]cover-view[代码][代码]>[代码][代码]</[代码][代码]cover-view[代码][代码]>[代码] JS: [代码]//获取应用实例[代码][代码]const app = getApp()[代码] [代码]Page({[代码][代码] [代码][代码]onReady() {[代码][代码] [代码][代码]// app.loading(false)[代码][代码] [代码][代码]},[代码][代码] [代码][代码]onLoad(op) {[代码][代码] [代码][代码]var[代码] [代码]ctx = wx.createCameraContext();[代码][代码] [代码][代码][代码]this.handleAuth(ctx, this)[代码][代码][代码] [代码] [代码] [代码][代码]},[代码][代码] [代码][代码]handleAuth(ctx, me) {[代码][代码] [代码][代码]wx.getSetting({[代码][代码] [代码][代码]success(result) {[代码][代码] [代码][代码]result && result.authSetting[[代码][代码]'scope.camera'[代码][代码]] ? me.takePhoto(ctx) : wx.authorize({[代码][代码] [代码][代码]scope: [代码][代码]'scope.camera'[代码][代码],[代码][代码] [代码][代码]success(result) {[代码][代码] [代码][代码]console.log([代码][代码]'wx.authorize succeed'[代码][代码])[代码][代码] [代码][代码]me.takePhoto(ctx)[代码][代码] [代码][代码]},[代码][代码] [代码][代码]fail(result) {[代码][代码] [代码][代码]app.toast([代码][代码]'授权失败'[代码][代码])[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码] [代码] [代码][代码]},[代码][代码] [代码][代码]takePhoto: [代码][代码]function[代码][代码](ctx) {[代码][代码] [代码][代码]let me = [代码][代码]this[代码][代码] [代码][代码]me.setData({[代码][代码] [代码][代码]discernVisible: [代码][代码]true[代码][代码] [代码][代码]})[代码][代码] [代码][代码]ctx.takePhoto({[代码][代码] [代码][代码]success: [代码][代码]function[代码][代码](photo) {[代码][代码] [代码][代码]me.facecPhoto(ctx, photo.tempImagePath)[代码][代码] [代码][代码]},[代码][代码] [代码][代码]fail: [代码][代码]function[代码][代码](error) {[代码][代码] [代码][代码]console.log([代码][代码]'Take photo error:'[代码] [代码]+ JSON.stringify(error || [代码][代码]'uncatch exception'[代码][代码]))[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码][代码] [代码][代码]},[代码][代码] [代码][代码]facecPhoto(ctx, facePhoto) {[代码][代码] [代码][代码]let me = [代码][代码]this[代码][代码] [代码][代码]ajax(app.api.facecPhoto,[代码][代码] [代码][代码]function[代码][代码](result) {[代码][代码] [代码][代码]if[代码] [代码](result.statusCode == 200) {[代码][代码] [代码][代码] [代码][代码]} [代码][代码]else[代码] [代码]{[代码][代码] [代码][代码]me.takePhoto(ctx)[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码][代码]})[代码] 多次进入这个页面后调用camera, 微信会崩溃,是否是返回上一个页面camera没有释放或者其它原因,请问如何解决?
2018-10-22