diff --git a/OpenAction/ActionViewController.swift b/OpenAction/ActionViewController.swift index 2a4c493ebf..afe78b94a4 100644 --- a/OpenAction/ActionViewController.swift +++ b/OpenAction/ActionViewController.swift @@ -64,9 +64,16 @@ class ActionViewController: UIViewController { 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 = current as? UIApplication { + application.open(url, options: [:], completionHandler: nil) + break + } + } else { + if current.responds(to: selectorOpenURL) { + current.perform(selectorOpenURL, with: url, afterDelay: 0) + break + } } responder = current.next } diff --git a/ShareExtension/ShareViewController.swift b/ShareExtension/ShareViewController.swift index 98829b4cbe..5afada430c 100644 --- a/ShareExtension/ShareViewController.swift +++ b/ShareExtension/ShareViewController.swift @@ -84,9 +84,16 @@ class ShareViewController: SLComposeServiceViewController { let deepLink = URL(string: AppDeepLinkSchemes.quickLink.appending(url.absoluteString))! var responder = self as UIResponder? while responder != nil { - if responder!.responds(to: selector) { - _ = responder?.perform(selector, with: deepLink, with: {}) - break + if #available(iOS 18.0, *) { + if let application = responder as? UIApplication { + application.open(deepLink, options: [:], completionHandler: nil) + break + } + } else { + if responder!.responds(to: selector) { + _ = responder?.perform(selector, with: deepLink, with: {}) + break + } } responder = responder!.next }