我在我的应用程序中使用 AppleHealthKit。一切正常。问题是我无法检测到用户在请求许可时是否点击了“不允许”按钮。
通过这种方法,我的应用程序使用了 HealthKit,即使用户不允许这样做也是如此。
requestAuthorizationToShareTypes(healthKitTypesToWrite, readTypes: healthKitTypesToRead) { (success, error) -> Void in
if( completion != nil ) {
completion(success:success,error:error)
}
苹果文档:
所以基本上我的问题是如何检测到这一点?
最佳答案
您无法检测到它,这是设计使然:
To help prevent possible leaks of sensitive health information, your app cannot determine whether a user has granted permission to read data. If you are not given permission, it simply appears as if there is no data of the requested type in the HealthKit store.
(来自 HKHealthStore)
关于ios - 如何检测用户是否不允许 Apple Health Kit 授权?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38801941/