Is it possible to open the Health app programmatically, like one can do with the Settings app?
If it's not possible to open the app's Apple Health permissions screen directly, can we at least open the main Apple Health screen?
Edit: I know that I cannot request permissions again - just like with other things like Camera access, etc. However, if the user refuses Camera permissions, I can direct them to the Settings page directly where they can change those permissions.
NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
[[UIApplication sharedApplication] openURL:url];
Is there such a thing for Health App?
It looks like since iOS 10+ it is possible to open the Health app.
UIApplication.shared.open(URL(string: "x-apple-health://")!)
For details take a look at this
Stackoverflow post
Swift 5, safer way -
func openUrl(urlString: String) {
guard let url = URL(string: urlString) else {
return
}
if UIApplication.shared.canOpenURL(url) {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
}
Usage:
openUrl(urlString: "x-apple-health://")
The health permissions are opened only once automatically by the system at the time where you request the HealthKitStore for the right permissions. If the user refuses the permissions, you can not open them again. You could try to ask for an additional permission just to make the screen appear, but even if this might work I assume this is not what Apple intended with the default behaviour and might risk your app being refused.
There is no API to send the user to the Health app.