onShow: function (option) {
console.log('onShow:', JSON.stringify(option))
// #ifdef APP-PLUS
// ? 在 onShow 时重新检查 plus.runtime.arguments
const argsInOnShow = plus.runtime.arguments
const launcherInOnShow = plus.runtime.launcher
console.log('? [onShow] plus.runtime.arguments:', argsInOnShow)
console.log('? [onShow] plus.runtime.launcher:', launcherInOnShow)
// ? 检查 onShow 参数中是否有 Universal Link 信息
console.log('? [onShow] option.path:', option.path)
console.log('? [onShow] option.query:', JSON.stringify(option.query))
console.log('? [onShow] option.referrerInfo:', JSON.stringify(option.referrerInfo))
// iOS Universal Link 可能通过 option 传递路径
if (option.path && option.path !== 'pages/guide/index' && option.path !== 'pages/index/index') {
console.log('✅ [onShow] 检测到非首页路径:', option.path)
const query = option.query || {}
// 防止重复跳转
if (!this._onShowNavigated) {
this._onShowNavigated = true
setTimeout(() => {
this.navigateToPage('/' + option.path, query)
// 重置标记,允许下次跳转
setTimeout(() => {
this._onShowNavigated = false
}, 2000)
}, 800)
}
}
// #endif
}
2 个回复
Ask小助手
该bug反馈内容完整有效,描述清晰:标题明确问题现象,提供了详细环境信息(HBuilderX 4.85/iOS 26/Vue2)、可复现代码示例及具体操作步骤(safari打开hzjuting://链接),并附带了关键日志输出。预期结果合理(应跳转详情页),实际结果异常(仅启动首页且参数为空),分类信息齐全。
经核查知识库,问题成立。依据《iOS URL Scheme配置文档》,uni-app应在
onShow中通过plus.runtime.arguments获取完整scheme参数。但用户日志显示参数始终为默认值{"name":"version","path":"","query":"","id":0},表明自定义基座环境未正确传递scheme数据。核心原因在于iOS自定义基座配置缺失:iOS 9+需在
info.plist中添加LSApplicationQueriesSchemes白名单声明自定义scheme(如hzjuting),否则系统会拦截参数传递。正式包因已包含完整配置可正常工作,而自定义基座未自动注入该配置。知识库《iOS scheme白名单配置》明确说明此要求。非误报问题,属平台特性限制。解决方案:1. 在HBuilderX中通过"manifest.json"可视化界面添加iOS的
LSApplicationQueriesSchemes字段;2. 或手动修改自定义基座源码的info.plist,增加<string>hzjuting</string>等自定义scheme声明。建议用户参考文档补充配置后重新制作自定义基座。PuGaaa (作者)
要回复问题请先登录或注册
公告
更多>相关问题