ios URL Sheme在uni-app自定义基座中只能拉起APP无法跳转到详情页面

ios URL Sheme在uni-app自定义基座中只能拉起APP无法跳转到详情页面

开发环境 版本号 项目创建方式
Mac macOS 26.1 HBuilderX

示例代码:

onShow: function (option) { console.log(‘onShow:’, JSON.stringify(option))
// #ifdef APP-PLUS
const argsInOnShow = plus.runtime.arguments
const launcherInOnShow = plus.runtime.launcher
console.log(’? [onShow] plus.runtime.arguments:’, argsInOnShow)
console.log(’? [onShow] plus.runtime.launcher:’, launcherInOnShow)

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))

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
}


# 操作步骤:


iphone safari浏览器 / 备忘录 打开sheme链接  -------》 app拉起  ------〉  

控制台:onShow:,  {"path":"pages/guide/index","query":{},"scene":1001,"referrerInfo":{"extraData":{}},"channel":"simulator","launcher":"default"} at App.vue:749
17:00:00.076 ? [onShow] plus.runtime.arguments:,  {"name":"version","path":"","query":"","id":0} at App.vue:755
17:00:00.076 ? [onShow] plus.runtime.launcher:,  default at App.vue:756
17:00:00.076 ? [onShow] option.path:,  pages/guide/index at App.vue:759
17:00:00.076 ? [onShow] option.query:,  {} at App.vue:760
17:00:00.076 ? [onShow] option.referrerInfo:,  {"extraData":{}} at App.vue:761
17:00:00.076 [第1次尝试] ===== Deep Link 调试 ===== at App.vue:540
17:00:00.076 [第1次尝试] launcher: default at App.vue:541
17:00:00.076 [第1次尝试] args 原始值: {"name":"version","path":"","query":"","id":0} at App.vue:542
17:00:00.076 [第1次尝试] args 类型: string at App.vue:543
17:00:00.077 [第1次尝试] 检测到默认空参数,跳过 at App.vue:555
17:00:00.077 [第1次尝试] 解析结果: valid=false, urlStr= at App.vue:577
17:00:00.077 ? [newintent] 收到新 intent 事件 at App.vue:317
17:00:00.077 ? [newintent] arguments:,  {"name":"version","path":"","query":"","id":0} at App.vue:320
17:00:00.077 ? [newintent] launcher:,  default at App.vue:321
17:00:00.077 [第1次尝试] ===== Deep Link 调试 ===== at App.vue:540
17:00:00.077 [第1次尝试] launcher: default at App.vue:541
17:00:00.077 [第1次尝试] args 原始值: {"name":"version","path":"","query":"","id":0} at App.vue:542
17:00:00.077 [第1次尝试] args 类型: string at App.vue:543
17:00:00.077 [第1次尝试] 检测到默认空参数,跳过 at App.vue:555

预期结果:

拉起app后跳转到详情页


# 实际结果:


拉起app后未识别 sheme 类型 ,未获取到路由参数,停在首页

更多关于ios URL Sheme在uni-app自定义基座中只能拉起APP无法跳转到详情页面的实战教程也可以访问 https://www.itying.com/category-93-b0.html

3 回复

该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声明。建议用户参考文档补充配置后重新制作自定义基座。 内容为 AI 生成,仅供参考

更多关于ios URL Sheme在uni-app自定义基座中只能拉起APP无法跳转到详情页面的实战教程也可以访问 https://www.itying.com/category-93-b0.html


LSApplicationQueriesSchemes,具体添加到manifest.json哪个字断下
《iOS scheme白名单配置》似乎通篇在介绍 urlschemewhitelist , 但是这个方法似乎是我的APP跳转到其他APP ,但实际上 我的过程是 H5 跳转到自己的APP 为什么还需要设置白名单
我是使用的 云打包, 手动修改自定义基座源码的info.plist 似乎做不到

根据你的描述和代码,问题在于自定义基座中未能正确解析URL Scheme的参数。从控制台输出可以看到,plus.runtime.arguments 返回的是默认值 {"name":"version","path":"","query":"","id":0},而不是你期望的URL Scheme携带的路径和参数。

这通常是由于自定义基座的配置问题导致的。在uni-app中,自定义基座需要正确配置URL Scheme才能正常解析参数。以下是关键点:

  1. 检查manifest.json配置:确保在 app-plus -> distribute -> apple 下正确配置了URL Types。示例如下:
"urltypes": [
    {
        "urlidentifier": "com.example.app",
        "urlschemes": ["yourappscheme"]
    }
]
回到顶部