SwiftUI Previews crash with 2.13.0 (UniFFI 0.0.5 static lib) — please release 2.13.x pinning UniFFI 0.0.6
## Description
After upgrading from `2.10.2` to `2.13.0`, SwiftUI previews crash with `EXC_BAD_ACCESS` / `SIGBUS` on launch — `XCPreviewAgent` terminates before any user view code runs. The app builds, launches, and runs phone calls correctly; only previews are affected.
This is the follow-up I mentioned in [#893](https://github.com/livekit/client-sdk-swift/issues/893#issuecomment):
> I also had a issue when using the the latest build that were making my Xcode Previews crash, but if it happens again with the fix I'll create another issue.
## Environment
- **Xcode**: 26.4.1
- **macOS**: 26.4.1
- **Project deployment target**: iOS 16
- **LiveKit SDK version**: 2.13.0 (transitively pulls `livekit-uniffi-xcframework` 0.0.5)
## Symptom
Three consecutive `XCPreviewAgent` crash reports captured during normal preview workflow:
```
Process: XCPreviewAgent
Exception Type: EXC_BAD_ACCESS (SIGBUS / SIGSEGV)
Subtype: KERN_PROTECTION_FAILURE / KERN_INVALID_ADDRESS
```
All three crashes hit unmapped/protected `VM_ALLOCATE` regions at high virtual addresses (e.g. `0x368699c90`, `0x37d9e0e6a`, `0x3bd52106e`). Backtraces are truncated by the corpse reporter (`_dyld_process_info_create failed with 5`) and `usedImages` is empty — symptoms typical of a thread-local / static-runtime collision during dyld load.
Reverting `client-sdk-swift` to `2.10.2` in the same project restores previews.
## Diagnosis
The transitive dependency `livekit-uniffi-xcframework` 0.0.5 ships `RustLiveKitUniFFI.xcframework` as a **static library**. The [0.0.6 release](https://github.com/livekit/livekit-uniffi-xcframework/releases/tag/0.0.6) (Apr 20, 2026) has a single commit titled *"Update to dylibs (#11)"* and switches the binary target to a **dynamic library**.
`XCPreviewAgent` uses dyld with non-standard linkage and is much stricter about static library runtime than the regular app launcher. Static Rust libraries with TLS slots, signal handlers, and cryptographic primitives are a known source of preview-agent crashes; switching to dylib resolves the loading-model mismatch.
`client-sdk-swift` `main` already pins `livekit-uniffi-xcframework` to `0.0.6`, but the latest released tag (`2.13.0`) still pins `0.0.5`.
## Request
Please cut a `2.13.x` (or `2.14.0`) release that pins `livekit-uniffi-xcframework 0.0.6`. That alone should restore SwiftUI preview compatibility for consumers on the latest SDK.
Happy to verify against a pre-release tag if useful.
关闭于 2026-05-04 2 条评论