部分iOS 设备
- 发布:2025-01-04 00:19
- 更新:2025-01-04 00:24
- 阅读:30
产品分类: uniapp/App
PC开发环境操作系统: Mac
PC开发环境操作系统版本号: 13.5 (22G74)
HBuilderX类型: 正式
HBuilderX版本号: 4.44
手机系统: iOS
手机系统版本号: iOS 16
手机厂商: 苹果
手机机型: iphone 12
页面类型: nvue
vue版本: vue3
打包方式: 云端
项目创建方式: HBuilderX
操作步骤:
预期结果:
正常
正常
实际结果:
不能正常工作
不能正常工作
bug描述:
自从 阿里云 切换到 支付宝云,就不断报错,有用户反馈打开就白屏,严重影响我们软件的 用户体验。
线上用户端报错:
[WX_KEY_EXCEPTION_WXBRIDGE] [undefined:2:1054] TypeError: undefined is not an object (evaluating 'e.apply') js stack: @
对应到编译后的代码
function Km(e) {. // 报错的函数
return function() {
try {
return e.apply(e, arguments) // 报错的代码位置
} catch (t) {
console.error(t)
}
}
}
// 调用它的函数
function dc(e) {
let t = {};
for (let i in e) {
let a = e[i];
rc(a) && (t[i] = Km(a)) // 只有这里调用
}
return t
}
// 调用了上面 dc 的两个函数
fr.init = function(e) {
e.env = e.spaceId;
let t = yD.call(this, e);
t.config.provider = "tencent", t.config.spaceId = e.spaceId;
let i = t.auth;
return t.auth = function(a) {
let n = i.call(this, a);
return ["linkAndRetrieveDataWithTicket", "signInAnonymously", "signOut", "getAccessToken",
"getLoginState", "signInWithTicket", "getUserInfo"
].forEach(s => {
var u;
n[s] = (u = n[s], function(o) {
o = o || {};
let {
success: l,
fail: c,
complete: h
} = dc(o);
// ---------------------------------------》 在这里再次调用 dc
if (!(l || c || h)) return u.call(this, o);
u.call(this, o).then(d => {
l && l(d), h && h(d)
}, d => {
c && c(d), h && h(d)
})
}).bind(n)
}), n
}, t.customAuth = t.auth, t
};
// 或者
var s_ = {
tcb: Pl,
tencent: Pl,
aliyun: nD,
private: Hl,
dcloud: Hl,
alipay: AD
},
qe = new class {
init(e) {
let t = {},
i = s_[e.provider];
if (!i) throw new Error("\u672A\u63D0\u4F9B\u6B63\u786E\u7684provider\u53C2\u6570");
return t = i.init(e), a_(t), RD(t),
function(a) {
let n = a.uploadFile;
a.uploadFile = function(s) {
return n.call(this, s)
}
}(t),
function(a) {
a.database = function(n) {
if (n && Object.keys(n).length > 0) return a.init(n).database();
if (this._database) return this._database;
let s = Yl(ha, {
uniClient: a
});
return this._database = s, s
}, a.databaseForJQL = function(n) {
if (n && Object.keys(n).length > 0) return a.init(n).databaseForJQL();
if (this._databaseForJQL) return this._databaseForJQL;
let s = Yl(ha, {
uniClient: a,
isJQL: !0
});
return this._databaseForJQL = s, s
}
}(t),
function(a) {
a.getCurrentUserInfo = GD, a.chooseAndUploadFile = XD.initChooseAndUploadFile(a), Object
.assign(a, {
get mixinDatacom() {
return Oc(a)
}
}), a.SSEChannel = hr, a.initSecureNetworkByWeixin = i_(a), a.setCustomClientInfo =
n_, a.importObject = QD(a)
}(t), ["callFunction", "uploadFile", "deleteFile", "getTempFileURL", "downloadFile",
"chooseAndUploadFile"
].forEach(a => {
if (!t[a]) return;
let n = t[a];
t[a] = function() {
return n.apply(t, Array.from(arguments))
}, t[a] = function(s, u) {
return function(o) {
let l = !1;
u === "callFunction" && (l = (o && o.type || ta.DEFAULT) !== ta
.DEFAULT);
let c = u === "callFunction" && !l,
h = this._initPromiseHub.exec();
o = o || {};
let {
success: d,
fail: p,
complete: g
// -----------------------》 在这里再次调用 dc
} = dc(o), D = h.then(() => l ? Promise.resolve() : Ae(Be(u,
"invoke"), o)).then(() => s.call(this, o)).then(m => l ?
Promise.resolve(m) : Ae(Be(u, "success"), m).then(() => Ae(
Be(u, "complete"), m)).then(() => (c && Ue(me
.RESPONSE, {
type: wt.CLOUD_FUNCTION,
content: m
}), Promise.resolve(m))), m => l ? Promise.reject(m) : Ae(
Be(u, "fail"), m).then(() => Ae(Be(u, "complete"), m))
.then(() => (Ue(me.RESPONSE, {
type: wt.CLOUD_FUNCTION,
content: m
}), Promise.reject(m))));
if (!(d || p || g)) return D;
D.then(m => {
d && d(m), g && g(m), c && Ue(me.RESPONSE, {
type: wt.CLOUD_FUNCTION,
content: m
})
}, m => {
p && p(m), g && g(m), c && Ue(me.RESPONSE, {
type: wt.CLOUD_FUNCTION,
content: m
})
})
}
}(t[a], a).bind(t)
}), t.init = this.init, t
}
};
1 个回复
工程狮 (作者)
nvue 不维护,也不要搞出错误,老项目怎么办