I'm using UniFFI to write part of my iOS app's backend. My cargo.toml is as follows:
[package]
name = "shared"
[lib]
crate-type = ["cdylib","staticlib"]
name = "shared"
[[bin]]
name = "uniffi-bindgen"
path = "uniffi-bindgen.rs"
[dependencies]
# ...
uniffi = { version = "0.25.3", features = [ "cli" ] }
[build-dependencies]
uniffi = { version = "0.25.3", features = [ "build" ] }
My build process is as follows
$ $HOME/.cargo/bin/cargo rustc -p shared --lib --crate-type staticlib --target aarch64-apple-ios --release
$ cargo run --bin uniffi-bindgen generate --library target/aarch64-apple-ios/release/libshared.a --language swift --out-dir out
The build goes well. I have added libshared.a to my Swift project, and it looks like things are just golden. When I launch the app, however, I get
dyld[48396]: Library not loaded: /Users/evan/Code/lym/shared/target/aarch64-apple-ios/release/deps/libshared.dylib
Referenced from: <13D3FB17-599F-37F1-9485-7723FD3232DF> /private/var/containers/Bundle/Application/A0E4BE0B-EE07-4C0D-A77A-7F13ED4BA8CE/lym.app/lym
Reason: tried: '/Users/evan/Code/lym/shared/target/aarch64-apple-ios/release/deps/libshared.dylib' (no such file), '/private/preboot/Cryptexes/OS/Users/evan/Code/lym/shared/target/aarch64-apple-ios/release/deps/libshared.dylib' (no such file), '/Users/evan/Code/lym/shared/target/aarch64-apple-ios/release/deps/libshared.dylib' (no such file)
Which is odd because it should be a static library.