Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] How to add .framework to asset correctly #1094

Closed
rainyl opened this issue Apr 18, 2024 · 2 comments
Closed

[Question] How to add .framework to asset correctly #1094

rainyl opened this issue Apr 18, 2024 · 2 comments

Comments

@rainyl
Copy link
Contributor

rainyl commented Apr 18, 2024

I am building the native C wrappers of OpenCV using conan and CMake, referring to native_assets_toolchain_c, I can compile it successfully and get opencv_dart.framework for ios, the compiled framework looks like:

opencv_dart.framework
|-- Info.plist
`-- opencv_dart

1 directory, 2 files

But I don't know how to correctly add it to assets to consume in Flutter, I added the opencv_dart(i.e., the dylib, you can find more details here: https://github.com/rainyl/opencv_dart/blob/d5eea8976cfd645b8dba5e8fe17dcfad95b8b1e9/hook/native_toolchain_conan.dart#L162C5-L204C37) to asset as normal NativeCodeAsset, it worked on a simulator, I am not a experienced IOS developer but it seems with out info.plist, It can't be correctly upload to APP Store, rainyl/opencv_dart#11

So, would you mind explain more about how to add the framework to asset of buildOutput correctly? Thanks a lot!

@dcharkes
Copy link
Collaborator

@rainyl nice to meet you!

Flutter itself packages things in a framework with a plist.
The build.dart outputs a dylib (per architecture), and the iOS/MacOS build bundle these dylibs (each for every target architecture) in a framework with the correct plist.

If you're interested in the implementation:

It is not supported to provide a framework from build.dart.

I believe the automatic packaging into framworks by the implementation in Flutter is sufficient to publish to the store. See discussions on:

If this doesn't work for your use case, please let us know.

@rainyl
Copy link
Contributor Author

rainyl commented Apr 18, 2024

Thanks! Native Assets is really useful to distribute native codes, waiting for it's graduation and thanks for your efforts!

@rainyl rainyl closed this as completed Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants