ios - CMMotionactivitymanager授权状态

标签 ios iphone core-motion cmmotionmanager

我想获取 CMMotionActivityManager 的授权状态。对于日历和位置等其他服务,我们在 API 中有一些属性可以为我们提供这些类的用户授权状态。我如何获得 CMMotionActivityManager 类的授权状态?

最佳答案

CMMotionActivityManager 目前不提供像其他框架那样直接检查授权状态的方法。

iOS - is Motion Activity Enabled in Settings > Privacy > Motion Activity

但是,如上述问题中的评论所述,如果您尝试使用

进行查询
queryActivityStartingFromDate:toDate:toQueue:withHandler

如果用户未授权您的应用程序,处理程序 (CMMotionActivityQueryHandler) 将返回此错误。

CMErrorMotionActivityNotAuthorized

关于ios - CMMotionactivitymanager授权状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23360460/

相关文章:

iOS 应用程序在使用 CMPedometer 功能时崩溃

ios - 用motionManager iOS 替换共享加速计

ios - 为什么在主线程上调用闭包时我的动画会被忽略?

iphone - 以编程方式移动 digdog MapKitDragAndDrop 框架中的引脚

ios - 是否可以获取 iOS 用户当前的 healthkit 状态?

iPhone 轮(运势)转动势头

iPhone - 使图像适应视网膜显示

ios - 在 UITableView 中滚动时 CustomCell 图像发生变化

ios - 在 Swift 中检查 UIContentContainer 是否为 ViewContoller

ios - 如何快速检查@NSManaged 属性是否为零?