在什么情况下CLAuthorizationStatus"限制"?

时间:2016-12-09 12:39:41

标签: ios swift core-location

Apple documentation表示CLAuthorizationStatus .restricted表示:

  

用户无法更改此应用的状态,可能是由于活动状态   家长控制等限制已经到位。

有人可以告诉我除了父母控制之外还有什么其他原因会导致这种情况吗?

我想向用户提供有关如何删除限制的有用信息,但不确定我该怎么说。

2 个答案:

答案 0 :(得分:1)

You can find the long list of possible restrictions in within the "Settings" app.

Settings -> General -> Restrictions:

...

(way more scrolling down)

答案 1 :(得分:0)

我发现另一种情况,将为CLAuthorizationStatus返回.restricted。我的应用程序(在运行iOS 10.3的iPhone 5上)启动后便立即请求权限,并且在极少数情况下,此请求是在应用程序实际上位于前台并返回.restricted之前发生的,即使Locations Services处于打开状态且该应用程序已在前台时的位置权限。

在这种情况下,我从未刷新过权限请求,因此该应用程序禁用了其基于位置的功能。因此,我的建议是在询问之前确保您的应用程序处于前台,如果您不能这样做,请尝试刷新CLAuthorizationStatus(如果它第一次返回.restricted)。

相关问题