I'm currently using Swift to write an independent Apple Watch app for watchOS 7+. My app uses Location Services, and in case the user doesn't allow that at first, I'd like to have a button inside my watchOS app to send my user to the part of the Settings app (inside watchOS) where he can give the appropriate permissions for the app.
I know that in iOS/macOS you can use the openSettingsURLString string from UIApplication to do what I want, but it's not available in watchOS and I haven't found any equivalent resource inside the WKExtension class (normally the equivalent for UIApplication in the watchOS environment, as discussed here).
Does anyone know if there's any way to programatically open the Apple Watch Settings app from my watchOS app?
The code below is what I'm trying to do - but (of course) it crashes since I'm not actually passing any systemURL.
.alert(isPresented: $alertVisible) {
Alert (title: Text("Please allow our app to use location services in order to get Weather Data"),
message: Text("Go to Settings?"),
primaryButton: .default(Text("Settings"), action: {
WKExtension.shared().openSystemURL(URL(string: "")!)
//UIApplication.shared.open(URL(string: UIApplication.openSettingsURLString)!)
}),