8

I've added a custom URL scheme to my Xcode project (I'm using SwiftUI).

enter image description here

In the AppDelagate file I've added:

func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
        print(url.absoluteString)
        print("work")
        return true
    }

When I to Safari (sampleurlscheme://) in either the emulator or a physical device the code is not being executed (i.e. the logs do not show etc), But it is taking me to the app.

Is there something I'm missing or could this be a bug ?

39fredy
  • 1,923
  • 2
  • 21
  • 40
  • it appears that this is being handled in SceneDelegate.swift with function: func ```scene(_ scene: UIScene, openURLContexts URLContexts: Set)``` – 39fredy Sep 16 '19 at 19:23
  • I was also having this issue. Thanks! – A.C. Wright Sep 16 '19 at 23:07
  • Does this answer your question? [Method 'application:openURL:options:' is not called](https://stackoverflow.com/questions/58624786/method-applicationopenurloptions-is-not-called) – Hejazi Dec 17 '19 at 11:27
  • Visit here for updated iOS 13 and later: https://stackoverflow.com/questions/47291172/custom-url-schemes/62136667#62136667 – Ashish Chauhan Jun 13 '20 at 09:25

1 Answers1

12

It appears that this is being handled in SceneDelegate.swift with function:

func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>)
39fredy
  • 1,923
  • 2
  • 21
  • 40