Repository navigation
Conversation
+isAppExtension, HasSCInfoFolder() and HasEmbeddedMobileProvision() only had branches for TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH and for TARGET_OS_OSX. TARGET_OS_IOS is 0 on visionOS, so they ended without returning a value there, and callers got whatever was left over. Check TARGET_OS_OSX first and use the bundle-based checks everywhere else, so visionOS gets the same checks as iOS.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On visionOS, three functions in
GULAppEnvironmentUtil.mend without returning a value:+isAppExtension,HasSCInfoFolder()andHasEmbeddedMobileProvision(). Their#ifcoveredTARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCHand thenTARGET_OS_OSX, butTARGET_OS_IOSis 0 on visionOS, so neither branch is compiled there. The caller gets whatever is left in the return register or on the stack. SwiftPM builds pass-Wno-return-type, and CI doesn't run the tests on visionOS, so nothing reported it.Effects on visionOS
+isAppExtensioncan return YES in an app. ThenGULAppDelegateSwizzlerandGULSceneDelegateSwizzlerskip swizzling, and+supportsBackgroundURLSessionUploadsreturns NO. FirebaseCore uses it to decide whether a secondconfigurecall is allowed, andFIRBundleUtiluses it when matching bundle IDs.+isFromAppStorecould be wrong, because it depends onHasSCInfoFolder()andHasEmbeddedMobileProvision(). On simulators it returns NO before reaching them.We found this in firebase/firebase-ios-sdk#17142. There, an unrelated change to FirebaseCore altered the stack contents, and the visionOS Simulator jobs on Xcode 26 started seeing
isAppExtensionreturn YES.Fix
Each function now checks
TARGET_OS_OSXfirst and uses the bundle-based check in the#elsebranch. So visionOS gets the same checks as iOS, and no platform can fall through without returning. Behavior on iOS, Mac Catalyst, tvOS, watchOS and macOS is unchanged. Building the package with-Wreturn-typefor each platform now reports no warnings; before this change, visionOS reported these three.Tests
testIsAppExtensionInAppExtensionBundleswizzles-[NSBundle bundlePath]to return an.appexpath, and expectsisAppExtensionto be YES everywhere except macOS.testIsAppExtensionchecks that the test runner isn't reported as an extension.Not included: visionOS in CI
CI still doesn't run the tests on visionOS. On a visionOS Simulator the full suite has two other failures:
testProxyRemoteNotificationsMethodsEmptyAppDelegateandtestProxyRemoteNotificationsMethodsEmptyAppDelegateAfterInitialProxyexpectapplication:handleEventsForBackgroundURLSession:completionHandler:to be proxied on visionOS.GULAppDelegateSwizzleronly proxies it underTARGET_OS_IOS || TARGET_OS_TV. Fixing that changes swizzling behavior on visionOS, so it should be a separate PR, after which visionOS can join thespmmatrix.Testing
GoogleUtilities-Packagetest scheme: 170 unit tests ran, and only the two swizzler tests above failed. They're unrelated to this change.GULAppEnvironmentUtilTest: all 9 tests pass with the fix. With only the test change,testIsAppExtensionInAppExtensionBundlefails.swift buildandxctest): all 9GULAppEnvironmentUtilTesttests pass.swift build -Xcc -Wreturn-typefor the visionOS, iOS, tvOS and watchOS Simulators and for macOS: no-Wreturn-typewarnings.clang-formatreports the changed files as clean.This PR was prepared with AI assistance.