Reputation: 338
We`re developing an fitness journey app that uses HealthKit to import workouts from some other apps to our own.
Most users would just need to give Read Permissions. But in the future some might want to give our app Write Permissions to add our own info to their Health App.
Is it possible to ask for permissions in a 2-step process? The goal is to not overwhelm users by asking for a lot of info.
Upvotes: 2
Views: 784
Reputation: 6849
First question:
Yes, just ask for more permissions whenever you need them and the user is prompted. As many steps as you want.
Write permissions:
No problem to add them later.
iOS 10
nothing more to consider.
Thanks to Alan
up to iOS 9.3
But it doesn't help you: you can write workouts and active energy into the hk database. But Apples Activity App won't show workouts and active energy samples when you save them on an iPhone.
Since the average users use the activity app, it apears to them as if your app doesn't work. Even if it does.
(Tested with iOS 9.0 ... 9.3)
P.S.
Apple prohibits writing to exercise minutes and standing hours.
Authorization crashes without message if you try.
So you can't contribute to the green or blue ring.
Test if I'm right and file a bug report if you need it.
Upvotes: 3
Reputation: 636
Yes, you can do this without any major issues. One minor issue, the text that describes why you want access comes from your Info.plist file, so is hard-coded. While there are separate key for both sharing (reading) and updating (writing), the contents will need to work for all scenarios.
For example, if you first ask for sharing Steps, and later ask to share Heart Rate, in both case the single NSHealthShareUsageDescription key from your Info.plist will be displayed both times.
Also note that iOS 10 SDK requires these keys, so you'll need to come up with a single wording that works for both scenarios without confusing the user.
Upvotes: 0