APP-SERVICE-SDK:setStorageSync:fail Error: Failed To Send Sync;at App log function;at api request success callback function
Error: APP-SERVICE-SDK:setStorageSync:fail Error: Failed To Send Sync
at new t ([publib]:7:10135)
at Oo ([publib]:8:6460)
at Object.Wo.(anonymous function) [as setStorageSync] ([publib]:8:7826)
at Object.
at Function.
at Object.
at success (weapp:///app.js:46:20)
at Function.function.a.(anonymous function) ([publib]:6:29081)
at Object.success ([publib]:4:4154)
at X.
getOpenId: function getOpenId(cb) { var that = this ; wx.hideShareMenu(); if ( this .globalData.openId) { this .log( this .globalData.openId, '缓存' ); cb( this .globalData.openId); } else { //调用登录接口 wx.login({ success: function success(res) { var code = res.code; that.log(code, '实时获取到的 code' ); //通过code换取openid wx.request({ url: that.globalData.remoteUrl + '/api/login' , data: { _ajax: 1, code: code }, method: 'POST' , header: {}, success: function success(res) { that.log( 'getOpenid' , res); if (res.data.code == 1) { that.globalData.openId = res.data.data.xcxopenid; wx.setStorageSync( 'openId' , res.data.data.xcxopenid);//报错代码位置 if (res.data.data.token) { wx.setStorageSync( 'token' , res.data.data.token); that.globalData.token = res.data.data.token; } that.log(that.globalData.openId, '实时获取到的 openid' ); cb(that.globalData.openId); } else { cb(); } }, fail: function fail(res) { that.wlanchaoshi(res); } }); } }); } }, |
这个应该是setStorageSync过时的问题吧,说这些有的没的
昨天在家mac pro好好的,今天拿到公司的imac上就出问题了,我重新真机上传了一遍代码,就莫名其妙没了!好奇怪的bug
+1
我也遇到了,只有远程调试的时候会出现,现在知道是为什么吗?
不知道 导致远程调试没法用
额,你能直接用code换取openId???,不需要加密数据解密吗?
openid 必须后端来的获取的, 加密解密是为了更加安全吧
那也得传给后端加密数据,他们才能解密啊,我看代码你也没传给他们加密数据
我这边只需要传 code 就好了 code 传到后端 后端自行根据 code 来获取 openid 传到前端 没有毛病啊
您说的事情跟我问的这个问题没有关系吧