将flutter项目添加到现有iOS应用-framework

  • 将原项目转换成module的形式

  • 进入项目使用命令行打包flutter build ios-framework --output=../flutter_app

  • 打出包后,分为debug、profile、release三种形式

    image.png

  • debug包只能在模拟器运行

  • profile和release包在真机运行

进入App.xcframework->iOS...->App.framework->flutter_assets对比debug和release,发现release中少了几个文件,profilerelease一样。

[图片上传中...(751660014256_.pic.jpg-88b847-1660015202998-0)]

751660014256_.pic.jpg

这样就导致当我们在模拟器运行时,引入profile或者releaseframework时会报错

image.png

所以在模拟器调试时,一定不要用debug

关于module中存在plugin

当module中存在plugin时,首先将plugin导入

image.png

其次要对plugin进行注册

image.png

没有注册的话,会报错
[VERBOSE-2:ui_dart_state.cc(198)] Unhandled Exception: PlatformException(channel-error, Unable to establish connection on channel., null, null)

image.png
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容