UIApplication.shared.open iOS 18

Making the call as: UIApplication.shared.open(websiteURL) doesn't open the browser and gives the following in the console: BUG IN CLIENT OF UIKIT: The caller of UIApplication.openURL(:) needs to migrate to the non-deprecated UIApplication.open(:options:completionHandler:). Force returning false (NO).

However, making the call as: UIApplication.shared.open(websiteURL) { _ in } opens the browser and there is nothing in the cosole.

Does someone understand why is this or if it's Apple's iOS 18 bug? In the iOS & iPadOS 18 RC Release Notes | Apple Developer Documentation there is a section around resolving this or something similar, unsure.

Answered by Engineer in 803588022

openURL is deprecated and shouldn't have worked in iOS 17 either. You'll want to migrate to open(_:options:completionHandler:).

Rico

WWDR - DTS - Software Engineer

Those are two different methods.

This is the one with a closure that works https://developer.apple.com/documentation/uikit/uiapplication/1648685-open

This one, with no closure is deprecated and nonfunctional https://developer.apple.com/documentation/uikit/uiapplication/1622961-openurl

openURL is deprecated and shouldn't have worked in iOS 17 either. You'll want to migrate to open(_:options:completionHandler:).

Rico

WWDR - DTS - Software Engineer

I appreciate that Apple engineer answer, but respectfully I don't think that answers the question.

Yes, openURL has been deprecated since iOS 10, but the OP (and me) aren't using openURL, we're using open, which is NOT deprecated.

Perhaps some clues:

  1. The calls to UIApplication.shared.open() aren't showing a deprecation warning.
  2. Going to the definition of that function takes me to a protocol in FBSDKCoreKit:
/**
 Internal type exposed to facilitate transition to Swift.
 API Subject to change or removal without warning. Do not use.

 @warning INTERNAL - DO NOT USE
 */
NS_SWIFT_NAME(_InternalURLOpener)
@protocol FBSDKInternalURLOpener

- (BOOL)canOpenURL:(NSURL *)url;
- (BOOL)openURL:(NSURL *)url;
- (void)    openURL:(NSURL *)url
            options:(NSDictionary<UIApplicationOpenExternalURLOptionsKey, id> *)options
  completionHandler:(nullable void (^)(BOOL success))completion;

@end

Is FBSDKCoreKit intercepting these calls and sending them to the deprecated openURL version?

A little more googling turns up

https://github.com/facebook/facebook-ios-sdk/issues/2205

So it looks like the Facebook SDK is swizzling ALL calls to UIApplication.open and is instead using the deprecated version which no longer works. 🤦

Same here, for iOS 16-17 everything worked well.

My code didn't changed since that times:

UIApplication.shared.open(url)

And as result - just nothing happens. No errors or warning iOS 18 release or beta, whatever..

BUG IN CLIENT OF UIKIT

iOS 18 release was really really too early, this is just a BETA, still.

Same here, it seems that Swift does not understand which method to use because of default options and completion parameters, so I managed to use it like that:

UIApplication.shared.open(url, options: [])

But still, this is a bug and should not be like that.

Can confirm we have the same issue as well. I have to admit this is the only one of the many bugs that were brought by iOS18 release. For 10 years this is the worst release IMHO

it seems the issue also happen if you call MKMapItems.openMaps (or item.openInMaps) - which seem to call openUrl under the hood on macos catalyst.

My error was caused by using FB. It is issue described here. Fortunately it was solved with SDK version 17.3.0. So update it now.

UIApplication.shared.open(url) doesn't work UIApplication.shared.open(url, options: [:]) does work

That is 100% bug of iOS 18 My guess is openUrl was fully made not functional (in one way or another), and open used openUrl under the hood.

This should be fixed asap, cause alot of URLs in apps aren't openable now

UIApplication.shared.open iOS 18
 
 
Q