From d03b954c1c69040b4efb178f413813c4f001e678 Mon Sep 17 00:00:00 2001 From: Daymon Date: Wed, 15 Apr 2026 12:33:38 -0500 Subject: [PATCH 1/3] Add scene delegate support to universal links --- .../Sources/Runtime/FIRIAMActionURLFollower.m | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/FirebaseInAppMessaging/Sources/Runtime/FIRIAMActionURLFollower.m b/FirebaseInAppMessaging/Sources/Runtime/FIRIAMActionURLFollower.m index e80a4f29f48..f438a93aa74 100644 --- a/FirebaseInAppMessaging/Sources/Runtime/FIRIAMActionURLFollower.m +++ b/FirebaseInAppMessaging/Sources/Runtime/FIRIAMActionURLFollower.m @@ -168,9 +168,35 @@ - (BOOL)followURLWithAppDelegateOpenURLActivity:(NSURL *)url { // Try to handle the url as a universal link by triggering // application:continueUserActivity:restorationHandler: on App's delegate object directly. +// Will also look for scene delegates in the foreground that implement scene:continueUserActivity:. // @return YES if that delegate method is defined and seeing a YES being returned from // trigging it - (BOOL)followURLWithContinueUserActivity:(NSURL *)url { + // First try to find a scene delegate to trigger, falling back to app delegate + for (UIScene *scene in self.mainApplication.connectedScenes) { + if (scene.activationState == UISceneActivationStateForegroundActive || + scene.activationState == UISceneActivationStateForegroundInactive) { + id sceneDelegate = (id)scene.delegate; + if ([sceneDelegate respondsToSelector:@selector(scene:continueUserActivity:)]) { + FIRLogDebug(kFIRLoggerInAppMessaging, @"I-IAM240004", + @"Scene delegate responds to scene:continueUserActivity." + "Simulating action url opening from a web browser."); + // Use string literal to ensure compatibility with Xcode 26 and iOS 18 + NSString *browsingWebType = @"NSUserActivityTypeBrowsingWeb"; + NSUserActivity *userActivity = + [[NSUserActivity alloc] initWithActivityType:browsingWebType]; + userActivity.webpageURL = url; + + [sceneDelegate scene:scene continueUserActivity:userActivity]; + + // The scene delegate method doesn't return anything, so we assume the response is YES + FIRLogDebug(kFIRLoggerInAppMessaging, @"I-IAM240005", + @"Scene handling action URL returns YES, no more further action taken"); + return YES; + } + } + } + if (self.isContinueUserActivityMethodDefined) { FIRLogDebug(kFIRLoggerInAppMessaging, @"I-IAM240004", @"App delegate responds to application:continueUserActivity:restorationHandler:." From 5733fc98dcd37c34fab3603e3941f9ad11724d7b Mon Sep 17 00:00:00 2001 From: Daymon Date: Wed, 15 Apr 2026 12:34:47 -0500 Subject: [PATCH 2/3] Update CHANGELOG.md --- FirebaseInAppMessaging/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/FirebaseInAppMessaging/CHANGELOG.md b/FirebaseInAppMessaging/CHANGELOG.md index 64ca9d6955b..13f5a03511f 100644 --- a/FirebaseInAppMessaging/CHANGELOG.md +++ b/FirebaseInAppMessaging/CHANGELOG.md @@ -1,3 +1,7 @@ +# Unreleased +- [fixed] Fixed an issue where universal links were not correctly routed in apps utilizing scene + delegates. + # 12.1.0 - [fixed] Fix Xcode 26 crash from missing `NSUserActivityTypeBrowsingWeb` symbol. Note that this fix isn't in the 12.1.0 zip and Carthage From 6698ba38d5fac38ee66f01ee11877c4bc2e7c88f Mon Sep 17 00:00:00 2001 From: Daymon Date: Wed, 15 Apr 2026 12:39:35 -0500 Subject: [PATCH 3/3] Update CHANGELOG.md --- FirebaseInAppMessaging/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FirebaseInAppMessaging/CHANGELOG.md b/FirebaseInAppMessaging/CHANGELOG.md index 13f5a03511f..ad671bb2985 100644 --- a/FirebaseInAppMessaging/CHANGELOG.md +++ b/FirebaseInAppMessaging/CHANGELOG.md @@ -1,6 +1,6 @@ # Unreleased - [fixed] Fixed an issue where universal links were not correctly routed in apps utilizing scene - delegates. + delegates. (#16083) # 12.1.0 - [fixed] Fix Xcode 26 crash from missing `NSUserActivityTypeBrowsingWeb`