link_check/link_check.rs
1//! Links every FFI entry point into an executable so `otool -L` can prove
2//! which Swift runtime libraries the binary ended up depending on.
3//!
4//! The failure this guards against is silent: if the linker resolves
5//! `libswift_Concurrency` against Xcode's Swift 5.5 back-deployment copy
6//! instead of the one in the OS, the dependency is recorded as
7//! `@rpath/libswift_Concurrency.dylib` and the app dies at launch with
8//! "Library not loaded" — on a user's device, not on the build machine.
9//!
10//! ```text
11//! cargo build -p cranpose-storekit --example link_check --target aarch64-apple-ios
12//! otool -L target/aarch64-apple-ios/debug/examples/link_check | grep swift
13//! ```
14//!
15//! Every `swift` line must be an absolute `/usr/lib/swift/...` path.
16
17fn main() {
18 cranpose_storekit::register();
19 #[cfg(any(target_os = "ios", target_os = "macos"))]
20 {
21 use cranpose_services::purchases::{self, Purchases};
22 purchases::configure(&["com.example.link.check"]);
23 let backend = cranpose_storekit::StoreKitPurchases;
24 backend.purchase("com.example.link.check");
25 backend.restore();
26 println!("{:?}", purchases::store_state());
27 }
28}