简体   繁体   English

如何撤销HealthKit授权

[英]How to revoke HealthKit Authorization

In my application, I am using a HealthKit, all going good. 在我的应用程序中,我正在使用HealthKit,一切都很好。 Authorization done using this code 使用此代码完成的授权

 NSArray *readTypes = @[
                    [HKObjectType quantityTypeForIdentifier:HKQuantityTypeIdentifierStepCount],
                    [HKObjectType quantityTypeForIdentifier:HKQuantityTypeIdentifierHeartRate],
                    [HKObjectType quantityTypeForIdentifier:HKQuantityTypeIdentifierActiveEnergyBurned]                           ];

    NSArray *writeTypes = @[
                   [HKObjectType quantityTypeForIdentifier:HKQuantityTypeIdentifierStepCount],
                   [HKObjectType quantityTypeForIdentifier:HKQuantityTypeIdentifierHeartRate],
                   [HKObjectType quantityTypeForIdentifier:HKQuantityTypeIdentifierActiveEnergyBurned]                            ];

    [self.healthStore requestAuthorizationToShareTypes:[NSSet setWithArray:writeTypes]
                                             readTypes:[NSSet setWithArray:readTypes] completion:^(BOOL success, NSError * _Nullable error) {
                                                 NSLog(@"Succes ==>%d",success);
                                                  NSLog(@"error ==>%@",error);
                                             }];

Now I want to revoke it, how ? 现在我想撤销它,怎么办? Please help me. 请帮我。

There is no way to revoke authorization programmatically. 无法以编程方式撤销授权。 If you'd like to test the behavior of your app when authorization is revoked, uninstall the app and reinstall it, or tap the Reset Location & Privacy button in Settings > General > Reset. 如果您想在撤销授权时测试应用程序的行为,请卸载该应用程序并重新安装,或者在“设置”>“常规”>“重置”中点击“重置位置和隐私”按钮。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM