PuGaaa
PuGaaa
  • 发布:2025-12-08 17:17
  • 更新:2025-12-08 17:29
  • 阅读:26

【报Bug】ios URL Sheme在自定义基座中 ,只能拉起APP,无法跳转到详情页面

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Mac

PC开发环境操作系统版本号: macOS 26.1

HBuilderX类型: 正式

HBuilderX版本号: 4.85

手机系统: iOS

手机系统版本号: iOS 26

手机厂商: 苹果

手机机型: iphone 13 pro

页面类型: vue

vue版本: vue2

打包方式: 云端

项目创建方式: HBuilderX

App下载地址或H5⽹址: http://www.hzjuting.com/download

示例代码:

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  

}

操作步骤:

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 类型 ,未获取到路由参数,停在首页

bug描述:

H5通过sheme方式拉起IOS APP,APP成功拉起,但是无法跳转到详情页
APP.vue onShow中 plus.runtime.launcher 启动为 default ; plus.runtime.arguments 打印 {"name":"version","path":"","query":"","id":0}
正式包正常跳转,测试证书以及Ad_Hoc在自定义基座环境下都测试过,都无法跳转和准确获得sheme

2025-12-08 17:17 负责人:无 分享
已邀请:
Ask小助手

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声明。建议用户参考文档补充配置后重新制作自定义基座。

内容为 AI 生成,仅供参考
  • PuGaaa (作者)

    LSApplicationQueriesSchemes,具体添加到manifest.json哪个字断下

    《iOS scheme白名单配置》似乎通篇在介绍 urlschemewhitelist , 但是这个方法似乎是我的APP跳转到其他APP ,但实际上 我的过程是 H5 跳转到自己的APP 为什么还需要设置白名单

    我是使用的 云打包, 手动修改自定义基座源码的info.plist 似乎做不到

    2025-12-08 19:08

PuGaaa

PuGaaa (作者)

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

要回复问题请先登录注册