ios - 用户不允许权限时的CMMotionActivityManager回调
<p><p>我正在使用来自隐私提示项目的以下代码来获取运动权限。</p>
<pre><code>- (void)requestMotionAccessData {
self.cmManager = [ init];
self.motionActivityQueue = [ init];
[self.cmManager startActivityUpdatesToQueue:self.motionActivityQueue withHandler:^(CMMotionActivity *activity) {
/*
* Do something with the activity reported
*/
NSLog(@"requestMotionAccessData");
;
;
}];
}
</code></pre>
<p>如果用户不允许移动权限怎么办。我得到一些回调吗?
如果没有,是否有其他方法可以得到这个。当用户选择 <code>Allow</code> 或 <code>Don't Allow</code></p> 时,我想要回调</p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>你可以...选择错误:</p>
<pre><code>
to:
toQueue:
withHandler:^(NSInteger numberOfSteps, NSError *error) {
if (error != nil && error.code == CMErrorMotionActivityNotAuthorized) {
// The app isn't authorized to use motion activity support.
}
</code></pre>
<p>从这里:<a href="https://stackoverflow.com/q/21005990/1702413" rel="noreferrer noopener nofollow">iOS - is Motion Activity Enabled in Settings > Privacy > Motion Activity</a> </p></p>
<p style="font-size: 20px;">关于ios - 用户不允许权限时的CMMotionActivityManager回调,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/24286510/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/24286510/
</a>
</p>
页:
[1]