位置服务不适用于iOS 8
我在iOS 7上运行良好的应用程序不适用于iOS 8 SDK。
  CLLocationManager没有返回一个位置,我也没有在设置 - >位置服务下看到我的应用程序。  我在这个问题上进行了Google搜索,但没有出现。  什么可能是错的? 
我最终解决了自己的问题。
  显然,在iOS 8 SDK中,在开始位置更新之前,需要requestAlwaysAuthorization (用于后台位置)或requestWhenInUseAuthorization (仅在前台调用位置时)在CLLocationManager上调用。 
  还需要在Info.plist使用NSLocationAlwaysUsageDescription或NSLocationWhenInUseUsageDescription项,并在提示中显示一条消息。  添加这些解决了我的问题。 

希望它可以帮助别人。
编辑:有关更多信息,请查看:Core-Location-Manager-Changes-in-ios-8
我用同样的问题拉我的头发。 Xcode给你的错误:
  试图在不提示位置授权的情况下启动MapKit位置更新。  必须首先调用-[CLLocationManager requestWhenInUseAuthorization]或-[CLLocationManager requestAlwaysAuthorization] 。 
  但即使您实现了上述方法之一,也不会提示用户,除非在info.plist中有NSLocationAlwaysUsageDescription或NSLocationWhenInUseUsageDescription 。 
将以下行添加到您的info.plist中,其中字符串值表示您需要访问用户位置的原因
<key>NSLocationWhenInUseUsageDescription</key>
<string>This application requires location services to work</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>This application requires location services to work</string>
我认为这些条目可能在我在Xcode 5中启动这个项目后缺失。我猜Xcode 6可能会为这些键添加默认条目,但尚未确认。
你可以在这里找到关于这两个设置的更多信息
为了确保这与iOS 7向后兼容,您应该检查用户是否正在运行iOS 8或iOS 7.例如:
#define IS_OS_8_OR_LATER ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
//In ViewDidLoad
if(IS_OS_8_OR_LATER) {
   [self.locationManager requestAlwaysAuthorization];
}
[self.locationManager startUpdatingLocation];
                        链接地址: http://www.djcxy.com/p/51795.html
                        上一篇: Location Services not working in iOS 8
下一篇: Receive Addressbook data in iOS7 xCode (iOS 6 is working)
