Our app was rejected because our app does not offer the option to select the shared data.
Next Steps
Please provide detailed answers to the following questions in your reply to this message in Resolution Center:
Provide steps where we can locate the HealthKit integration in your app where the user can choose which health data they want to share. We only located a "Apple Health" import feature.
However, according to the guidelines (https://developer.apple.com/design/human-interface-guidelines/healthkit/overview/), this should not be done by the app at all, but by the iOS settings.
Manage health data sharing solely through the system’s privacy settings. People expect to globally manage access to their health information in Settings > Privacy. Don’t confuse people by building additional screens in your app that affect the flow of health data.
What does Apple expect from us?
CodePudding user response:
You need to ask for permission with the native screen.
@IBAction func enableHealthKit(sender: AnyObject) {
var shareTypes = Set<HKSampleType>()
shareTypes.insert(HKSampleType.workoutType())
var readTypes = Set<HKObjectType>()
readTypes.insert(HKObjectType.workoutType())
healthStore.requestAuthorizationToShareTypes(shareTypes, readTypes: readTypes) { (success, error) -> Void in
if success {
print("success")
} else {
print("failure")
}
if let error = error { print(error) }
}
}
Here it is asking for workoutType but you can ask for different types or several of them. Then users can change in settings what they want to share. More about this code example https://cocoacasts.com/managing-permissions-with-healthkit.
If this is not enough for Apple you can always make some button in settings that is opening iOS settings with this Health data permission.