From 1cb26237ee41ae1a4cfb7bc2087159727181b6d3 Mon Sep 17 00:00:00 2001 From: George Vardikos Date: Mon, 16 Dec 2024 17:30:35 +0200 Subject: [PATCH] Bugfix FXIOS-10884, FXIOS-10736 "Open in Firefox" of share extension isn't working (#23762) Bugfix FXIOS-10884, FXIOS-10736 "Open in Firefox" of share extension isn't working (#23762) --- .../Extensions/ShareTo/ShareViewController.swift | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/firefox-ios/Extensions/ShareTo/ShareViewController.swift b/firefox-ios/Extensions/ShareTo/ShareViewController.swift index 20e6d8f3ffb8..c814dc675a9f 100644 --- a/firefox-ios/Extensions/ShareTo/ShareViewController.swift +++ b/firefox-ios/Extensions/ShareTo/ShareViewController.swift @@ -529,9 +529,15 @@ extension ShareViewController { var responder = self as UIResponder? let selectorOpenURL = sel_registerName("openURL:") while let current = responder { - if current.responds(to: selectorOpenURL) { - current.perform(selectorOpenURL, with: url, afterDelay: 0) - break + if #available(iOS 18.0, *) { + if let application = responder as? UIApplication { + application.open(url, options: [:], completionHandler: nil) + } + } else { + if current.responds(to: selectorOpenURL) { + current.perform(selectorOpenURL, with: url, afterDelay: 0) + break + } } responder = current.next