核心位置不工作在iOS 8 [英] Core Location not working in iOS 8

查看:108
本文介绍了核心位置不工作在iOS 8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在iOS 8中使用重大的更改位置监控,但didUpdateLocations方法从未被调用。以下是设置位置管理器的代码:

I'm trying to use significant change location monitoring in iOS 8, but the didUpdateLocations method is never called. Here is the code for setting up the location manager:

- (void)viewDidLoad
{
    [super viewDidLoad];
    CLLocationManager *locationManager = [[CLLocationManager alloc] init];
    locationManager.delegate = self;
    [locationManager requestWhenInUseAuthorization];
    [locationManager startMonitoringSignificantLocationChanges];
}

尽管调用 requestWhenInUseAuthorization ,没有弹出要求用户授权它。我设置了NSLocationWhenInUseUsageDescription,它仍然不工作。 didChangeAuthorizationStatus didFailWithError 也从不调用。
编辑:我可以让它要求用户允许位置服务,但即使你点击允许它从来不显示位置。

Despite calling requestWhenInUseAuthorization, nothing pops up to ask the user to authorize it. I have set NSLocationWhenInUseUsageDescription, and it still does not work. didChangeAuthorizationStatus and didFailWithError are also never called. I was able to get it to ask the user to allow location services, but even if you click allow it never shows the location.

推荐答案

iOS8 beta5目前有一个错误,它总是为您的应用程序停用地理位置服务(至少对我的)。

There is currently a bug in iOS8 beta5 which always deactivate geolocation service for your app (at least for mine).

进入 settings>隐私权>位置服务>您的应用>总是

但我不知道为什么,但即使将其设置为始终此设置将自动停用,因此请耐心等待,并经常返回设置以再次配置您的应用位置。

But I don't know why, but even if you set it to Always this setting will auto-deactivate, so please be patient and often return in the settings to configure again your app location.

这篇关于核心位置不工作在iOS 8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆