昨天在家mac pro好好的,今天拿到公司的imac上就出问题了,我重新真机上传了一遍代码,就莫名其妙没了!好奇怪的bug
开启远程调试时 经常报SDK:setStorageSync:fail这个错误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.([publib]:6:29338) at Function.([publib]:14:10718) at Object.([publib]:5:24761) at success (weapp:///app.js:46:20) at Function.function.a.(anonymous function) ([publib]:6:29081) at Object.success ([publib]:4:4154) at X.([publib]:6:24667) [代码]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);[代码][代码] [代码][代码]}[代码][代码] [代码][代码]});[代码][代码] [代码][代码]}[代码][代码] [代码][代码]});[代码][代码] [代码][代码]}[代码][代码] [代码][代码]},[代码]
2018-10-08