alipay / mPaaS

mPaaS Demo 合集,mPaaS 是源自于支付宝的移动开发平台。The collection of demos for mPaaS components. mPaaS is the Mobile Development Platform which oriented from Alipay.
https://tech.antfin.com/docs/2/49549
Apache License 2.0
324 stars 55 forks source link

iOS打开本地预置离线包,一直打开失败。 #21

Open Hanrovey opened 4 years ago

Hanrovey commented 4 years ago

参考官网代码链接:https://tech.antfin.com/docs/2/133648

1、初始化容器代码:

// 自定义jsapi路径和预置离线包信息
let presetApplistPath = Bundle.main.path(forResource: "BCSCustomPresetApps.bundle/h5_json.json", ofType: nil)
let appPackagePath = Bundle.main.path(forResource: "BCSCustomPresetApps.bundle", ofType: nil)
let pluginsJsapisPath = Bundle.main.path(forResource: "BCSCustomPlugins.bundle/Poseidon-UserDefine-Extra-Config.plist", ofType: nil)
MPNebulaAdapterInterface.initNebula(withCustomPresetApplistPath: presetApplistPath!, customPresetAppPackagePath: appPackagePath!, customPluginsJsapisPath: pluginsJsapisPath!)

// 定制容器
MPNebulaAdapterInterface.shareInstance().nebulaVeiwControllerClass = H5WebViewController.self
MPNebulaAdapterInterface.shareInstance().nebulaUserAgent = "mPaaS/Portal"
MPNebulaAdapterInterface.shareInstance().nebulaNeedVerify = false

// 更新离线包
MPNebulaAdapterInterface.shareInstance().requestAllNebulaApps { (data, error) in
    //            debugPrint("[mpaas] nebula rpc data : \(data)")
    debugPrint(data)
}

2、预置离线包配置Bundle信息:

屏幕快照 2019-09-10 上午11 29 52

3、打开预置离线包代码:

    // MARK: 预置离线包i
    @objc func openPresetPackage(_ sender: UIButton) {
        MPNebulaAdapterInterface.shareInstance().startH5ViewController(withNebulaApp: ["appId": "20190901"])
    }

4、报错页面 IMG_0151

vivi23vivi commented 4 years ago

预置资源包加载失败一般为预置包版本和包信息不匹配,测试本地预置离线包时,请先断开网络,避免离线包有更新,确保加载的是客户端本地预置的版本。

检查本地预置的离线包信息与 Plist 中配置的包信息是否一致,包括 appID、version、main_url 等信息。