Skip to content

Fix iOS crash and workaround debug hang - #1083

Merged
davecraig merged 2 commits into
Scottish-Tech-Army:mainfrom
davecraig:main
Sep 15, 2026
Merged

davecraig merged 2 commits into
Scottish-Tech-Army:mainfrom
davecraig:main

Conversation

@davecraig

Copy link
Copy Markdown
Contributor

No description provided.

davecraig and others added 2 commits September 15, 2026 09:34
Metal API Validation and GPU frame capture deadlock the app. MetalTools and
GPUToolsCapture inject objc retain traffic into Compose's render thread, which
then blocks on the objc sidetable lock while the main thread holds the objc
weak-table lock inside MapLibre's draw (objc_loadWeakRetained on a Kotlin
ObjCBackRef) and waits for a Kotlin/Native GC that can never suspend the render
thread. Three-way lock inversion with no timeout, so the UI never recovers.

Set in project.yml rather than Xcode's scheme editor: xcodegen omits both
attributes by default, so regenerating the project silently restores them.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011r7YyswsqGBpg3mYrEyiTV
Fixes "NSInvalidArgumentException -[APMMeasurement fetchSBT]: unrecognized
selector" crashes in release builds.

GoogleAppMeasurement ships its Objective-C categories in object files that each
export a dummy _APMInclude<Name>Category symbol, referenced from
APMMeasurement.o, so the linker keeps them under normal static archive
semantics without needing -ObjC. 12.19.0 added APMMeasurement+SBT.o and left
out the anchor: it defines nothing any other member references (only block
descriptors and ARC helpers), so the linker drops it, while APMMeasurement.o
still sends fetchSBT from startMeasurementOnWorkerQueue, updateSchedule,
uploadData and networkRemoteConfigFetchCompletionHandler:data:error:.
Confirmed by partial-linking the 12.19.0 archive: 0 APMMeasurement(SBT) methods
without -ObjC, all 5 with it.

The flag went into OTHER_LDFLAGS rather than the OTHER_LINKER_FLAGS block that
was already there, because OTHER_LINKER_FLAGS is not a build setting Xcode
recognises and was being silently dropped. Verified with a throwaway project:
-lnosuchlib under OTHER_LINKER_FLAGS builds fine, under OTHER_LDFLAGS fails to
link. The "-framework Shared" it contained was therefore inert too, which went
unnoticed because `import Shared` makes Swift autolink the framework anyway.

Firebase is now pinned exactly. `from: 12.18.0` is a >=12.18.0 <13.0.0 range and
Package.resolved isn't committed (it lives inside the generated, gitignored
.xcodeproj), so CI resolved whatever was newest at build time. That is how a
release shipped on GoogleAppMeasurement 12.19.0 while local builds were still on
12.18.0 - where nothing sends fetchSBT, so the crash could not be reproduced
here at all.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011r7YyswsqGBpg3mYrEyiTV
@davecraig
davecraig merged commit 73b7e2d into Scottish-Tech-Army:main Sep 15, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant