Skip to content

Commit 7eb1bd7

Browse files
authored
[FirebaseMessaging] Fix crash on Xcode 26 + iOS 18 (#15164)
1 parent feef47a commit 7eb1bd7

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

FirebaseInAppMessaging/Sources/Runtime/FIRIAMActionURLFollower.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,10 @@ - (BOOL)followURLWithContinueUserActivity:(NSURL *)url {
175175
FIRLogDebug(kFIRLoggerInAppMessaging, @"I-IAM240004",
176176
@"App delegate responds to application:continueUserActivity:restorationHandler:."
177177
"Simulating action url opening from a web browser.");
178+
// Use string literal to ensure compatibility with Xcode 26 and iOS 18
179+
NSString *browsingWebType = @"NSUserActivityTypeBrowsingWeb";
178180
NSUserActivity *userActivity =
179-
[[NSUserActivity alloc] initWithActivityType:NSUserActivityTypeBrowsingWeb];
181+
[[NSUserActivity alloc] initWithActivityType:browsingWebType];
180182
userActivity.webpageURL = url;
181183
BOOL handled = [self.appDelegate application:self.mainApplication
182184
continueUserActivity:userActivity

FirebaseInAppMessaging/Tests/Unit/FIRIAMActionUrlFollowerTests.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,10 @@ - (void)testUniversalLinkHandlingReturnYES {
8484
continueUserActivity:[OCMArg checkWithBlock:^BOOL(id userActivity) {
8585
// verifying the type and url field for the userActivity object
8686
NSUserActivity *activity = (NSUserActivity *)userActivity;
87+
// Use string literal to ensure compatibility with Xcode 26 and iOS 18
88+
NSString *browsingWebType = @"NSUserActivityTypeBrowsingWeb";
8789
return [activity.activityType
88-
isEqualToString:NSUserActivityTypeBrowsingWeb] &&
90+
isEqualToString:browsingWebType] &&
8991
[activity.webpageURL isEqual:url];
9092
}]
9193
restorationHandler:[OCMArg any]])

FirebaseMessaging/Sources/FIRMessaging.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,8 +400,10 @@ - (void)handleIncomingLinkIfNeededFromMessage:(NSDictionary *)message {
400400
// if they haven't implemented it.
401401
if ([NSUserActivity class] != nil &&
402402
[appDelegate respondsToSelector:continueUserActivitySelector]) {
403+
// Use string literal to ensure compatibility with Xcode 26 and iOS 18
404+
NSString *browsingWebType = @"NSUserActivityTypeBrowsingWeb";
403405
NSUserActivity *userActivity =
404-
[[NSUserActivity alloc] initWithActivityType:NSUserActivityTypeBrowsingWeb];
406+
[[NSUserActivity alloc] initWithActivityType:browsingWebType];
405407
userActivity.webpageURL = url;
406408
[appDelegate application:application
407409
continueUserActivity:userActivity

0 commit comments

Comments
 (0)