Repository navigation
Description
Version
posthog-ios 3.92.7 (SPM, statically linked). The two files in the stack below are byte-identical in 3.81.0 and unchanged through 3.93.6.
Steps to Reproduce
- iOS app built with Xcode 27.2 (27B52), Release, distributed through the App Store.
PostHogConfigwith defaults for surveys (surveys= true),sessionReplay= false on this launch,captureScreenViews= false,personProfiles = .always.PostHogSDK.shared.setup(config)runs from a SwiftUI.taskon the root view, right after launch.- Launch the app on an iPhone 16 (iPhone17,3) running iOS 27.2 beta (24B5084k). The device also has the Guided Access client loaded (
GAXClient.bundleappears in the image list).
We have one user report so far, on this beta. Users on iOS 27.0 and 26.x launch the same build normally.
Expected Result
The app launches.
Actual Result
The app is killed about 1 second after launch, on every launch, during the first Core Animation commit. A restart of the phone does not help.
Exception Type: EXC_BAD_ACCESS (SIGKILL)
Exception Subtype: KERN_PROTECTION_FAILURE at 0x0000000000000000
Termination Reason: CODESIGNING 2 Invalid Page
ktriageinfo: VM - (arg = 0x0) Failed to fault in a page with execute permissions
ESR: Instruction Abort, Translation fault; pc = 0x0, far = 0x0
Thread 0 Crashed (com.apple.main-thread):
0 ??? 0x0
1 App closure #1 in PostHogThrottledMulticastCallback.invoke(_:) (PostHogMulticastCallback.swift ~209)
2 App closure #1 in ApplicationViewLayoutPublisher.layoutHook(for:) (ApplicationViewLayoutPublisher.swift ~114)
3 App ApplicationViewLayoutPublisher.layoutHook(for:) (block thunk)
4 App closure #1 in ApplicationViewLayoutPublisher.layoutHook(for:) (ApplicationViewLayoutPublisher.swift ~110)
5 QuartzCore -[CALayer layoutSublayers] + 496
6 QuartzCore CA::Layer::perform_update_(...) + 596
7 QuartzCore CA::Layer::update_if_needed_(...) + 1120
8 QuartzCore CA::Layer::layout_and_display_if_needed(...) + 132
9 QuartzCore CA::Context::commit_transaction(...) + 612
10 QuartzCore CA::Transaction::commit() + 424
11 QuartzCore CA::Transaction::flush_as_runloop_observer(bool) + 224
12 UIKitCore _UIApplicationFlushCATransaction + 52
...
UIKitCore UIApplicationMain + 336
SwiftUI static App.main() + 172
Frames 1–4 were symbolicated against a rebuild of the same source with the same Xcode, so the frames are right but the line numbers are approximate. The registers at the crash hold OBJC_CLASS_$_NSLock and Date's type metadata and value witness table, which fits the lock and now() code in PostHogThrottledMulticastCallback.invoke.
Something on the layout hook path calls a null function pointer: the forwarded original layoutSublayers(of:) IMP, or a closure the hook reaches. swizzleLayoutSubviews() stores whatever method_getImplementation returns as a non-optional IMP, so a null IMP would only show up later as a call to 0x0. Guided Access also hooks UIKit, so the two swizzles may interact on this beta.
Workaround: config.surveys = false and config.sessionReplay = false. With both off, nothing subscribes to viewLayoutPublisher, so UIView.layoutSublayers(of:) is never swizzled. Could surveys subscribe to layout only when the project has active surveys? Today, apps that never use surveys still get the swizzle by default.
Activity
posthog commentedon Nov 7, 2026
PostHog self-driving picked up this issue and researched it. Somebody may already be working on it, so ask before you start a fix.
Report (team access only): https://us.posthog.com/project/2/inbox/reports/01a1b755-4eba-78d4-978d-271c3e5f9177?link_source=github_comment
marandaneto commentedon Nov 8, 2026
should be fixed by #896