App rejected, Health app permissions

时间:2017-03-02 23:46:33

标签: ios iphone swift watchkit health-kit

I'm having trouble getting my app approved, and to be honest, I'm having trouble understanding what Apple are on about in this case.

My app only uses HealthKit to create, pause, and finish a workout. It does not read any data.

From Apple: "Regarding the 2.1 issue, your app displays a window on iOS shortly after launching the watch app to start the process to allow your app to integrate with the Health app. No action takes place after tapping on “Open [AppName].” It would be appropriate to ensure your app displays the Health UI to allow permission to access the Health app."

The problem appears to be with my watchOS app not asking for permission to use the Health app. This is the code I'm using to do so:

In my ExtensionDelegate:

WorkoutManager.sharedManager.requestAuthorisation()

The requestAuthorisation function in my WorkoutManager:

//request workout authorisation only
func requestAuthorisation() {
    let writeTypes: Set<HKSampleType> = Set([ HKObjectType.workoutType() ]) //to write a workout

    healthStore.requestAuthorization(toShare: writeTypes, read: nil) { (success, error) in
        if error != nil {
            self.debug.log(tag: "WorkoutManager", content: "Error requesting HealthStore authorisation: \(error!.localizedDescription)")
        }
    }
}

Also, my iOS app does not use HealthKit (at least at the moment), so I'm not doing anything with HealthKit in the iOS app. Only the watchOS app uses HealthKit.

When you first run the app on the watch, it prompts you to allow authorisation to access the Health app. An accept or deny pop up appears on the iPhone, where you can choose. I thought this is what they were wanting? Surely they don't want me to custom write some "do you want to allow access to the Health app" view controller?

1 个答案:

答案 0 :(得分:-2)

Apple对他们的应用程序非常严格,因此您需要尽可能多的详细信息,当弹出窗口打开时,需要明确询问用户是否允许它与健康应用程序通信