关于 Flutter IOS混合开发打包Framework集成到原生IOS工程 和 flutter_boost使用

参考https://juejin.im/post/5d79af99e51d453c11684ce8

flutter_boost从0.1.53开始提供了swift demo,但example_swift居然跑不起来,oc的example可以。

1、 直接把example Flutter下的Debug.xcconfig、Release.xcconfig、AppFrameworkInfo.plist拷过来

更新分割线-------------------

这个blog的集成方法好像没集成插件- -,不过应该是move脚本有些问题没把所有framework文件cp过去,继续参考https://www.kikt.top/posts/flutter/exists/add-flutter-to-ios/?tdsourcetag=s_pctim_aiomsg

将四个framework文件都install进来,然后和android一样调路由和通信

 报错1:Could not cast value of type 'TabbarController' (0x1055dc680) to 'UINavigationController' 

解决:PlatformRouterImp.swift

    func navigationController() -> UINavigationController {

        let delegate = UIApplication.shared.delegate as! AppDelegate

        let navigationController = delegate.window?.rootViewController as! UINavigationController

        return navigationController;

    }
改成
    func navigationController() -> UINavigationController {

        let delegate = UIApplication.shared.delegate as! AppDelegate

        let root = delegate.window?.rootViewController as! TabbarController

        let navigationController = root.selectedViewController as!UINavigationController

        return navigationController;

    }

  报错2:参考链接,这是一个百度快照,最近简书抽风了好多文章看不了。http://cache.baiducontent.com/c?m=9d78d513d9d431d94f9a94697d61c0121d4381137d928b4139c3923884125f563164f4ba57356005c4b1787070db5e2aeee736036b5e37b7ea89cf1b87ac925970d571732e4b914163c419dedc4755807cc318feae69bee1b626d4ee8cdc8512158812127bf3ed961f4551dd6f874c6ab0fad812524810cdbc6d3ae21b6a2e9c2111e64dffe7373d05d6&p=882a9140cd904ead1db0c8235152&newp=8b2a97569fd01cff57e9912b515692695d0fc20e38ddd701298ffe0cc4241a1a1a3aecbf22241305d1c47d600ba94b5ce0f730783d0034f1f689df08d2ecce7e3cc13469&user=baidu&fm=sc&query=%BD%E2%BE%F6Swift%D6%D0%B3%F6%CF%D6+No+such+module+%27SnapKit%27&qid=f658b2a60001901a&p1=1

 集成:ios的flutter_boost集成比android简单一些直接在AppDelegate里初始化,在PlatformRouterImp里处理路由逻辑就行

 

posted @ 2019-09-25 10:20  nightfallsad  阅读(2334)  评论(0编辑  收藏  举报