CLLocationManager 委托未在 ios 10 swift 3 模拟器中调用

CLLocationManager delegate not called in ios 10 swift 3 simulator

永远不会调用 CLLocationManager 委托。这是我的代码:

  import UIKit
  import CoreLocation
  class LocationController: UITableViewController, CLLocationManagerDelegate {
  override func viewDidLoad() {
    super.viewDidLoad()
    if (CLLocationManager.locationServicesEnabled())
    {
        locationManager.delegate = self;
        locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters
        // ask permission - NOT NECESSARY IF YOU ALREADY ADDED NSLocationAlwaysUsageDescription IT UP INFO.PLIST
        locationManager.requestAlwaysAuthorization()
        // when in use foreground
        locationManager.requestWhenInUseAuthorization()
        locationManager.startUpdatingLocation()
    }
    else{
        print("set up location access  in info.plist")
    }
   }

   private func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
    print("locationmanager got called")
    let locValue:CLLocationCoordinate2D = manager.location!.coordinate
    print("locations = \(locValue.latitude) \(locValue.longitude)")
   }
  }

info.plist 设置:

我的模拟器设置:

开始申请后,您是否更改了位置?在菜单中:调试/位置/ ... 或更改默认位置(在您上次的屏幕截图中)