swift-dependencies: iOS 18 - OpenURL doesn't work as expected

Description

The provided openURL() is not functioning on iOS 18, as in the App never receives the deep link via the AppDelegate or openURL.

Same code that was functioning on iOS 17 is not working on iOS 18.

  case let .tappedButton(url):
      return .run { _ in
          await openURL(url)
      }

Checklist

  • I have determined whether this bug is also reproducible in a vanilla SwiftUI project.
  • If possible, I’ve reproduced the issue using the main branch of this package.
  • This issue hasn’t been addressed in an existing GitHub issue or discussion.

Expected behavior

I expect the URL to attempt to open.

Actual behavior

the URL does not attempt to open.

Steps to reproduce

  1. With openURL
  2. set breakpoint when receiving URL
  3. no URL is hit

OpenURLExample.zip

Dependencies version information

1.3.0

Destination operating system

iOS 18

Xcode version information

Version 16.0 beta (16A5171c)

Swift Compiler version information

swift-driver version: 1.90.11.1 Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
Target: arm64-apple-macosx14.0

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 20 (9 by maintainers)

Most upvoted comments

UIApplication Resolved Issues Fixed: Applications built with iOS 18.0, iPadOS 18.0, Mac Catalyst 18.0, or tvOS 18.0 SDKs will call to the deprecated method UIApplication.openURL(_😃. The specified URL will not open and will always return false. (125695759)

I may be misunderstanding the tech note, but that seems to imply that the deprecated UIApplication.openURL(_:) is now expected to not work. They are turning it off completely, which isn’t surprising because it has been deprecated for a very long time. Instead you are expected to call this API instead.

So I don’t think that tech note really has any bearing on the issue here. I think what we are going to have to do is stop using EnvironmentValues entirely and just use a platform specific openURL, which might also mean losing openURL on some platforms.

(Adding the “apple bug” label since this regression is due to a change in Apple’s SDKs.)