Hi all, I am currently facing an issue with openin...
# multiplatform
m
Hi all, I am currently facing an issue with opening app deeplinks from a Compose Multiplatform app when running on iOS. Maybe someone here has an idea... The app is written in Compose Multiplatform and compiles for Android and iOS targets. I am trying to open another app on the device via an app scheme (
<other-app://test>
). The deeplink opens the other app seamlessly in Android but on iOS opening the app fails without an error. When opening a webpage with the same mechanism, the browser opens, though. And when opening from a native iOS App, this works as well. This is the file
App.ios.kt
I am using to implement the native code:
Copy code
@Composable
actual fun getContextProvider(): ContextProvider {
    return object : ContextProvider {
        override fun launchIntent(url: String) {
            val nsUrl = NSURL.URLWithString(url)
            if (nsUrl == null) {
                println("invalid url: $url")
                return
            }
            val canOpen = UIApplication.sharedApplication.canOpenURL(nsUrl)
            if (canOpen) UIApplication.sharedApplication.openURL(nsUrl, options = emptyMap<Any?, Any>(), completionHandler = null)
            else println("Can not open url")
        }
    }
}
The
canOpen
check returns
true
but still the app is not opened... All hints welcome! TLDR: App scheme deeplink does not open on CMP for iOS
f
Check on the Xcode App output logs, sometimes, there is a reason printed
m
Thanks @François, indeed there was some info in there... The solution is to skip the part where I check for
canOpen
and just open it directly... 🎉