- 多次调用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-15 - 官方提供的密钥验签服务究竟怎么使用?一直报错。
小程序的密钥验签服务到底怎么使用?一直返回48001,官方文档只有潦草的几句描述。开过别的问题贴,也基本没啥回复,已经不知道如何是好了。参考链接和截图如下: https://developers.weixin.qq.com/miniprogram/dev/api/startSoterAuthentication.html [图片] access_token确保没有问题,是通过如下方式获取的: https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' + appid + '&secret=' + secre [代码]另外openid是对应指纹验证客户的openid,json_string是指纹验证成功后返回的resultJSON, [代码][代码]json_signature是指纹验证成功后返回的resultJSONSignature。 [代码] [代码]如果我胡乱提交个access_token,错误信息就是无效的access_token,但是我access_token确保没问题,就是一直48001。帮忙看下,否则指纹验证就没法使用了,谢谢。 [代码]
2018-08-02