我已经使用Flutter的add- to -app文档将一个小的Flutter应用程序作为现有iOS应用程序中的本机模块运行。
Flutter应用程序在pubspec.yaml中包含了一些来自assets文件夹的图像,如下所示:
assets:
- assets/根据Flutter文档,这些资产与应用程序捆绑在一起。
如果我单独运行Flutter应用程序,它工作得很好。但是当我在iOS中运行它时,我得到了这个错误:
The following assertion was thrown resolving an image codec:
2021-01-11 14:41:51.204874-0800 flutter: Unable to load asset: assets/CONNECT.png
flutter: When the exception was thrown, this was the stack:
2021-01-11 14:41:51.205397-0800 flutter: #0 PlatformAssetBundle.load (package:flutter/src/services/asset_bundle.dart:227:7)
flutter: Image provider: AssetImage(bundle: null, name: "assets/CONNECT.png")
2021-01-11 14:41:51.209366-0800 flutter: Image key: AssetBundleImageKey(bundle: PlatformAssetBundle#893a5(), name: "assets/CONNECT.png",我找到的任何文档都在讨论在iOS应用程序中加载Flutter资源,反之亦然。但这是一个Flutter应用程序,在原生iOS应用程序中加载自己的资源,我不确定是否可以修复。
以前有没有人这样做过,并且知道要解决的问题?
发布于 2021-04-14 09:24:17
今天我也遇到了同样的问题。
而flutter clean解决了我的问题。
https://stackoverflow.com/questions/65686847
复制相似问题