小程序內核 'reduce' of undefined (getSetting)
目前还不知如何复现,在小程序一开启,调用getSetting()時,内核有机率发生如下错误:
appServiceSDKScriptError TypeError: Cannot read property 'reduce' of undefined;at api getSetting beforeSuccess callback function X5JavaBridge:37:27048 r.beforeSuccess X5JavaBridge:32:1529 Object.beforeSuccess X5JavaBridge:31:30461 X5JavaBridge:29:1115 Object.h X5JavaBridge:16:24 Object.ret.invokeCallbackHandler X5JavaBridge:1:67 |
发生在内核程式库
function (e, t, n) { Object.defineProperty(t, "__esModule" , { value: !0 }), t.getSetting = void 0; var r = n(1), o = function () { var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; (0, r.invokeMethod)( "getSetting" , e, { beforeSuccess: function (e) { e.authSetting; e.authSetting = e.authSetting.reduce( function (e, t) { return e[t.scope] = 1 === t.state, e }, {}) } }) }; t.getSetting = o } |
不知为何e.authSetting是undefined
请问要如何避免这个错误,谢谢