Skip to content

Conversation

@philprime
Copy link
Member

@philprime philprime commented Dec 1, 2025

📜 Description

  • Adds check for isiOSAppOnVisionOS supporting all visionOS versions
  • Adds isiOSAppOnVisionOS, isiOSAppOnMac, isMacCatalystApp to device context

💡 Motivation and Context

Closes #3824
Closes #3825

💚 How did you test it?

visionOS

  • Added "Apple Vision (Designed for iPad)" to the list of supported destinations for the sample app iOS-Swift
  • Ran the scheme iOS-Swift
  • Tapped on "Capture Error" to send an error event
  • Checked the event context in Sentry if ios_app_on_visionos, ios_app_on_macos and mac_catalyst_app are set
OS Version Event ios_app_on_visionos ios_app_on_macos mac_catalyst_app
visionOS 26.1 Link
visionOS 26.0 Link
visionOS 2.5 Link
visionOS 2.4 Link
visionOS 2.3 Link
visionOS 2.2 Link
visionOS 2.1 Link
visionOS 2.0 Link
visionOS 1.2 Link
visionOS 1.1 Link
visionOS 1.0 Link

Note: During testing I encountered an unrecognized selector SDK crash on visionOS 1.1, even though it was gated with an availability check. I fixed it by adding the recognized selector check.

Unit Tests

In addition I added a unit test which asserts that the flag isiOSAppOnVisionOS is default false.

📝 Checklist

You have to check all boxes before merging:

  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 1, 2025

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 6960e9a

@codecov
Copy link

codecov bot commented Dec 1, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.767%. Comparing base (28f150e) to head (6960e9a).
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##              main     #6939       +/-   ##
=============================================
- Coverage   84.773%   84.767%   -0.006%     
=============================================
  Files          459       459               
  Lines        27517     27540       +23     
  Branches     12130     12145       +15     
=============================================
+ Hits         23327     23345       +18     
- Misses        4149      4154        +5     
  Partials        41        41               
Files with missing lines Coverage Δ
...Utils/Sources/TestSentryNSProcessInfoWrapper.swift 88.888% <100.000%> (+1.388%) ⬆️
Sources/Swift/Helper/SentryProcessInfo.swift 90.476% <100.000%> (+40.476%) ⬆️
Sources/Swift/SentryCrash/SentryCrashWrapper.swift 93.388% <100.000%> (+0.226%) ⬆️

... and 2 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 28f150e...6960e9a. Read the comment docs.

@philprime philprime self-assigned this Dec 3, 2025
@itaybre
Copy link
Contributor

itaybre commented Dec 12, 2025

@philprime are you waiting on something in particular for this?

@philprime philprime marked this pull request as ready for review December 23, 2025 14:00
@philprime philprime added the ready-to-merge Use this label to trigger all PR workflows label Dec 23, 2025
}
// Fallback for older versions: `UIWindowSceneGeometryPreferencesVision` is only available on visionOS
// https://developer.apple.com/documentation/uikit/uiwindowscene/geometrypreferences/vision?language=objc
return NSClassFromString("UIWindowSceneGeometryPreferencesVision") != nil
Copy link

Choose a reason for hiding this comment

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

Fallback incorrectly returns true for native visionOS apps

The fallback detection for isiOSAppOnVisionOS uses NSClassFromString("UIWindowSceneGeometryPreferencesVision") to check if running on visionOS. This class exists on all visionOS builds, so native visionOS apps on older visionOS versions (< 26.1, before the official API exists) will incorrectly return true when they should return false. Since the SDK officially supports visionOS as a native platform (per Package.swift), this could result in incorrect telemetry. A compile-time check like #if os(visionOS) could be used to always return false for native visionOS builds.

Fix in Cursor Fix in Web

@github-actions
Copy link
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1207.49 ms 1244.20 ms 36.71 ms
Size 24.14 KiB 1.03 MiB 1.01 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
bce9765 1229.42 ms 1243.49 ms 14.07 ms
daeeb27 1235.35 ms 1253.77 ms 18.42 ms
1fe932f 1231.92 ms 1253.44 ms 21.52 ms
d23a1b1 1218.94 ms 1239.53 ms 20.60 ms
5196f0d 1213.35 ms 1231.37 ms 18.02 ms
0a17f4a 1206.36 ms 1236.68 ms 30.33 ms
649265b 1235.16 ms 1264.59 ms 29.43 ms
5840d2d 1225.40 ms 1241.47 ms 16.07 ms
d1c0538 1227.49 ms 1246.96 ms 19.47 ms
d1c4916 1236.25 ms 1266.76 ms 30.51 ms

App size

Revision Plain With Sentry Diff
bce9765 23.74 KiB 874.06 KiB 850.32 KiB
daeeb27 23.75 KiB 989.12 KiB 965.37 KiB
1fe932f 23.75 KiB 913.63 KiB 889.88 KiB
d23a1b1 23.75 KiB 913.64 KiB 889.88 KiB
5196f0d 23.75 KiB 876.93 KiB 853.19 KiB
0a17f4a 24.14 KiB 1.01 MiB 1012.90 KiB
649265b 23.75 KiB 980.81 KiB 957.06 KiB
5840d2d 23.75 KiB 969.24 KiB 945.50 KiB
d1c0538 23.75 KiB 928.87 KiB 905.12 KiB
d1c4916 23.75 KiB 981.15 KiB 957.40 KiB

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

Labels

ready-to-merge Use this label to trigger all PR workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Identify when iOS app runs on a Mac Identify when iOS app runs on VisionOS

3 participants