0
目前在我的应用程序中,我正在提取用户坐标。我需要始终更新此坐标,以便将位置代码放在应用程序委托中的didFinishLaunchingWithOptions中。该代码是:使用核心位置获取坐标和计算谁是100米圆翼
let location = CLLocationManager()
class AppDelegate: UIResponder, UIApplicationDelegate, CLLocationManagerDelegate {
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
location.delegate = self
location.desiredAccuracy = kCLLocationAccuracyBest
location.requestAlwaysAuthorization()
location.requestWhenInUseAuthorization()
return true
然后,在同一AppDelegate.swift我实现委托方法来抓住每一个位置更新如下:
func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
print(locations)
}
的事情是,我一直在接收零值。
重要的是要提到我在模拟器上运行应用程序,但在调试菜单中我模拟骑自行车或甚至是Apple位置。
我错过了什么?
当然我编辑与NSLocationAlwaysUsageDescription和NSLocationWhenInUseUsageDescription
这是它的plist!非常感谢。 – JoseMartinFit