0
私はrequestAuthorizationがHealthKitデータをtableViewに使用するアプリケーションを持っています。アプリでHealthKitの統合を無効にするにはどうすればよいですか?
私はHealthKitデータを取得するために許可を求めるために、このコードを使用します。
- (IBAction)healthIntegrationButtonSwitched:(UISwitch *)sender {
if (sender.isOn) {
[[GSHealthKitManager sharedManager] requestAuthorization];
}
}
- (void)requestAuthorization {
if ([HKHealthStore isHealthDataAvailable] == NO) {
// If our device doesn't support HealthKit -> return.
return;
}
NSArray *readTypes = @[[HKObjectType characteristicTypeForIdentifier:HKCharacteristicTypeIdentifierDateOfBirth]];
NSArray *writeTypes = @[[HKObjectType quantityTypeForIdentifier:HKQuantityTypeIdentifierBodyMass],
[HKObjectType workoutType]];
[self.healthStore requestAuthorizationToShareTypes:[NSSet setWithArray:writeTypes]
readTypes:[NSSet setWithArray:readTypes] completion:nil];
}
私は私のhealthIntegrationButtonSwitched関数に「(sender.isOffが){場合は」許可を取り消すにはHealthKitの受け入れ、他のケースを追加することができます?
ありがとうございました!
なぜこのようにしたいのですか?私が知っている限り、HealthKitを使用して権限を無効にすることはできません。認証メソッドで空のNSSetを試してみることをお勧めします。 – mm282