helloB
helloB

Reputation: 3582

iOS: send user direct to health privacy settings

I am aware of how to generally open the settings from inside an iOS app, but is there a way to send them to settings > privacy > health? It seems this would be a standard thing to do, but I'm not seeing guidance on this in the docs.

Thanks for any suggestions.

Upvotes: 3

Views: 1364

Answers (3)

Talha Rasool
Talha Rasool

Reputation: 1152

You can navigate to Health using this URL in swift.

  if let url = URL(string: "App-prefs:HEALTH&path=SOURCES") {
            if UIApplication.shared.canOpenURL(url) {
                UIApplication.shared.open(url, options: [:], completionHandler: nil)
                result(true)
            }else
            {result(false)}
        }else{
            result(false)
        }

Upvotes: 1

Allan
Allan

Reputation: 7353

As of iOS 9.3 there is no API for opening the Settings app on iOS directly to Settings > Privacy > Health. You should file an enhancement request with Apple.

Upvotes: 1

Eugene Gordin
Eugene Gordin

Reputation: 4107

You can navigate to settings of your app:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];

As for the health kit, you prompt for the authorization, right? that's where the users should set everything. I don't know if you actually can show the authorization again to change the settings.

Upvotes: 0

Related Questions