Skip to content

feat: add iOS native exception capture support#331

Open
marandaneto wants to merge 12 commits intomainfrom
feat/ios-native-exception-capture
Open

feat: add iOS native exception capture support#331
marandaneto wants to merge 12 commits intomainfrom
feat/ios-native-exception-capture

Conversation

@marandaneto
Copy link
Member

@marandaneto marandaneto commented Mar 11, 2026

💡 Motivation and Context

The captureNativeExceptions config option previously only supported Android. This PR adds iOS support, enabling automatic capture of native crashes (Mach exceptions, POSIX signals, and uncaught NSExceptions) via the PostHog iOS SDK's errorTrackingConfig.autoCapture API.

💚 How did you test it?

  • Added a "Test Native Crash" button to the example app that triggers a native crash via method channel on both iOS and Android
  • Enabled captureNativeExceptions = true in the example app config

iOS: missing line numbers - to figure out

Screenshot 2026-03-11 at 16 15 37

Android: missing sources - expected

Screenshot 2026-03-11 at 16 16 01

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.

If releasing new changes

  • Ran pnpm changeset to generate a changeset file
  • Added the release label to the PR

@marandaneto marandaneto force-pushed the feat/ios-native-exception-capture branch from d8d81a9 to 4fd0635 Compare March 11, 2026 13:10
#endif

// Configure error tracking
#if os(iOS) || os(macOS) || os(tvOS)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ioannisj should this be under only these 3 plastforms or all?
autocapture is only these 3 right, manual capture everything
so i guess the in app stuff makes sense for all platforms?

@marandaneto
Copy link
Member Author

@ioannisj something to figure out here https://posthog.slack.com/archives/C07AA937K9A/p1773239632233809?thread_ts=1773236734.446239&cid=C07AA937K9A
not a blocker but we should make it clear on this sdk/docs and also for the ios sdk/docs

@marandaneto marandaneto marked this pull request as ready for review March 11, 2026 15:24
@marandaneto marandaneto requested a review from a team as a code owner March 11, 2026 15:25
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "# uncomment to upload mapping files to PostHog\n# POSTHOG_INCLUDE_SOURCE=1 ${PODS_ROOT}/PostHog/build-tools/upload-symbols.sh\n";
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hpouillot uncomment this otherwise it wont trigger, had to remove it to make CI happy

Comment on lines +37 to +41
# needs device pairing - enable debug mode on the device
# make sure you have a valid team in Xcode, go to Signing & Capabilities
flutter devices
flutter run --release -d Manoel --verbose
# replace Manoel with your device's name/id
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hpouillot we need release mode and you cant run release mode on emulators

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant