Closed CJBuchel closed 2 weeks ago
Hi, could you please try frb v2's default approach (use cargokit) and see whether it works?
I'm not completely familiar with cargokit, but I'll try hunt down the documentation for it and try it's approach.
If you use v2, you do not need to setup anything about compilation. Just run the commands in https://cjycode.com/flutter_rust_bridge/quickstart.
Close since this seems to be solved, but feel free to reopen if you have any questions!
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new issue.
Describe the bug
I'm fairly certain this issue is related to my project not being setup correctly for iOS but I can't find much information on setting up for an iOS app using FRB with a rust library.
For context, I have a Flutter app project which compiles to Android, Web and iOS. And I have a rust library that just holds structures and a small amount of logic for those structures.
For iOS I used FRB to generate the dart code, then I switched out the crate-type from cdylib to static lib.
crate-type = ["rlib", "staticlib"]
I compile using
cargo lipo --release --targets aarch64-apple-ios-sim x86_64-apple-ios
and I place the generated universal static binarylitms_infra.a
inside myiOS/Runner
directory.I've also modified my pod file to search and link this binary
Likewise in the xcworkspace opened in Xcode, I've added the
libtms_infra.a
as a library to be linked in the build phase for Runner.When doing this, it seems to compile. But when running the simulator I get the runtime error, and the app just displays white.
I'm not particularly sure why this is occurring. I'm not the biggest iOS developer so I'm unsure why it's trying to get a tms_infra.framework file, or where this file would even be created. Or even why it's trying to link against it. From a small amount of reading, it seems like a dynamic library it's trying to load, which is confusing to me. Because everything I've done I have thought is static.
I have found parts of the FRB documentation that specifies the setup for an iOS project, but I'm not really sure if it applies to me or not, as one seems to be for a pure dart library (not an app) https://cjycode.com/flutter_rust_bridge/manual/integrate/library/platform-setup/ios-and-macos
And the other seems focused on crating a crate xcodeproj https://cjycode.com/flutter_rust_bridge/manual/integrate/existing/ios
So I haven't specifically tried those methods out. I wanted to check if there was a specific method/documentation for actually setting up a flutter app integrating a rust binary from FRB. Or what my issue might be related to?
Steps to reproduce
Hint: Clone https://github.com/CJBuchel/TMS
tms-infra
crate for static lib aarch64-apple-ios-simLogs
Expected behavior
No response
Generated binding code
No response
OS
No response
Version of
flutter_rust_bridge_codegen
2.1.0
Flutter info
No response
Version of
clang++
No response
Additional context
No response