2

I am looking for a way to open an apple watch app from another apple watch app. I have found answers for iOS apps. I am looking for something similar to this answer, but for watchOS instead of iOS.

I have tried to duplicate the iOS answer for watchOS but had no luck. The code I used is:

func openApp() {
    let url = URL(string:"App Name")
    WKExtension.shared().openSystemURL(url!)
}

I was hoping this would open the app, however, nothing happened when the function was called.

Dávid Pásztor
  • 51,403
  • 9
  • 85
  • 116
Bernard
  • 1,004
  • 1
  • 12
  • 21

1 Answers1

7

The documentation of the openSystemURL(_:) method clearly states that the URL supplied to it has to support the tel: or sms: scheme and can only be used for starting a phone call or writing messages. It cannot be used to open any other applications, especially not 3rd party ones.

watchOS doesn't support URL schemes at the moment (as of watchOS 5), unlike iOS, so you won't be able to open other apps from your app's WatchKit Extension.

Dávid Pásztor
  • 51,403
  • 9
  • 85
  • 116
  • 2
    Unfortunately, as of WatchOS 9 Beta, your statement is still valid: You cannot open 3rd party applications with that method. However, it is far from "clear" from the documentation, that other URL Schemes are not supported. Specifically since the document that you are linking explicitly refers to the [URL Scheme Reference](https://developer.apple.com/library/archive/featuredarticles/iPhoneURLScheme_Reference/Introduction/Introduction.html#//apple_ref/doc/uid/TP40007899), where other schemes are discussed. – gekart Jun 21 '22 at 11:01