Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom URL Scheme not working on Swift 5, Xcode 11

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 ?

like image 405
39fredy Avatar asked Sep 16 '19 18:09

39fredy


1 Answers

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

func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>)
like image 98
39fredy Avatar answered Nov 16 '22 05:11

39fredy