swift – Why Links inside my iOS app will always open in safari browser and not in corresponding app?


My app uses WebView as a wrapper for my web application. Inside my web application is a button that should launch a specific app if it is available on the iOS iPhone, and others that should be open in browsers.
The problem is that a click on the button will always open a browser.

This is the link to the app that should be launched by clicking on the button.
https://apps.apple.com/be/app/itsme/id1181309300

`func handleItsmeUrl(with requestUrl: URL){
        // Try to open the Itsme app using the newer method
        UIApplication.shared.open(requestUrl, options: [:]) { success in
            if success {
                // Successfully opened the phone dialer
            } else {
                if !self.hasHandledSpecialHost {
                    let request = URLRequest(url: requestUrl)
                    self.webView.load(request)
                    self.hasHandledSpecialHost = true
                    return
                }
            }
        }
    }`

I am using Xcode 15 with min target 13.
Is there anything else I need to do in my app, in Xcode or in the App Store?

Latest articles

spot_imgspot_img

Related articles

Leave a reply

Please enter your comment!
Please enter your name here

spot_imgspot_img