uni-app iOS 端 getUniMPVersionInfoWithAppid 拿到的值为nil,导致小程序打开空白?

uni-app iOS 端 getUniMPVersionInfoWithAppid 拿到的值为nil,导致小程序打开空白?

信息类别 详情
产品分类 uniapp/App
PC开发环境操作系统 Windows
PC开发环境操作系统版本号 10
HBuilderX类型 正式
HBuilderX版本号 4.17
手机系统 iOS
手机系统版本号 iOS 17
手机厂商 苹果
手机机型 iPhoneXR
页面类型 vue
vue版本 vue2
打包方式 云端
项目创建方式 HBuilderX

示例代码:

func checkUniMPResoutce(appid: String) -> Void {  
    let wgtPath = Bundle.main.path(forResource: appid, ofType: "wgt") ?? ""  

    warning ("注意:isExistsUniMP: 方法判断的仅是运行路径中是否有对应的应用资源,宿主还需要做好内置wgt版本的管理,如果更新了内置的wgt也应该执行 releaseAppResourceToRunPathWithAppid 方法应用最新的资源")  

    if DCUniMPSDKEngine.isExistsUniMP(appid) {  
        let version = DCUniMPSDKEngine.getUniMPVersionInfo(withAppid: appid)  
        let name = version?["code"]  
        let code = version?["code"]  
        print("小程序:\(appid) 资源已存在,版本信息:name:\(name) code:\(code)")  
    } else {  
        do {  
            try DCUniMPSDKEngine.installUniMPResource(withAppid: appid, resourceFilePath: wgtPath, password: nil)  
            let version = DCUniMPSDKEngine.getUniMPVersionInfo(withAppid: appid)  
            let name = version?["code"]  
            let code = version?["code"]  
            print("✅ 小程序:\(appid) 资源释放成功,版本信息:name:\(name) code:\(code)")  
        } catch let err as NSError {  
            print("❌ 小程序:\(appid) 资源释放失败:\(err)")  
        }  
    }  
}

操作步骤:

预期结果:

实际结果:

bug描述:

iOS 对接 uni小程序 SDK 初始化调用 DCUniMPSDKEngine.getUniMPVersionInfo(withAppid: appid) 拿到的 version 信息为 nil,导致后续打开小程序页面空白


更多关于uni-app iOS 端 getUniMPVersionInfoWithAppid 拿到的值为nil,导致小程序打开空白?的实战教程也可以访问 https://www.itying.com/category-93-b0.html

回到顶部