【发布时间】:2014-01-27 03:55:57
【问题描述】:
如果应用需要访问Motion Activity 数据,它会在安装时询问用户。但是,如果用户不小心回答“否”,则应用程序将无法运行。
我正在寻找一种方法来检查 Motion Activity 是否已启用,以便在未启用时提示用户启用。
有人能指点我正确的方向吗?
根据 Doc 提供的信息(谢谢),Apple 似乎没有提供直接方法来检查隐私中 Motion Activity 的状态。我能够通过发现错误来找出答案:-
[stepCounter queryStepCountStartingFrom:[NSDate date]
to:[NSDate date]
toQueue:[NSOperationQueue mainQueue]
withHandler:^(NSInteger numberOfSteps, NSError *error) {
if (error != nil && error.code == CMErrorMotionActivityNotAuthorized) {
// The app isn't authorized to use motion activity support.
}
【问题讨论】:
标签: ios core-motion