ios - HealthKit 权限,WatchOS 和 iOS 都需要吗?

标签 ios swift healthkit watchos ios-permissions

iOS 和 WatchOS 都需要 HealthKit 权限吗?

我正在向 watchOS 请求授权,watchOS 会引导用户打开 iOS 应用程序以获取权限。为了传输信息,我通过在两个设备之间创建 WCSession 使用 WatchConnectivity。

只显示来自 watch 的权限是否足够?

最佳答案

您的 iOS 应用程序必须在其应用程序委托(delegate)中实现 applicationShouldRequestHealthAuthorization(_:) 并在 HKHealthStore 上调用 handleAuthorizationForExtension(completion:) 以完成您的 iOS 应用发出的授权请求。文档中提供了更多详细信息 here .

关于ios - HealthKit 权限,WatchOS 和 iOS 都需要吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44703827/

相关文章:

ios - 使用 RxSwift 的 API 函数

ios - 如果健康应用程序尚未设置,如何使用 healthkit?

ios - 在手机上跟踪室内锻炼时保持 iOS 应用程序运行

ios - 如何在其他类中使用导入的HealthKit样本

ios - UICollectionViewCell 在滚动时消失

ios - Firebase Cloud Messaging 推送通知不再出现在 iOS 上

ios - 将数据从 TableView 传递到 View Controller

ios - 这个方便是什么意思?

ios - 为数组中的每个字符串获取 firebase 数据

ios - 无法使闭包语法在 swift 4 中工作