I have the following code:
import CoreLocation
class ViewController: UIViewController, NetworkingDelegate, CLLocationManagerDelegate {
let locationManager: CLLocationManager = CLLocationManager()
and then later:
locationManager.delegate = self
locationManager.desiredAccuracy = kCLLocationAccuracyBest
locationManager.requestWhenInUseAuthorization()
locationManager.startUpdatingLocation()
and then I implement the delegate methods lower in the VC
func locationManager(manager: CLLocationManager!, didUpdateLocations locations: [AnyObject]!) {
for currentLocation in locations{
print("\(index)\(currentLocation)")
}
print("Did Location Delegate get called?")
let location: CLLocation = locations.first as! CLLocation
print(location)
self.lat = String(format: "%f", location.coordinate.latitude)
self.long = String(format: "%f", location.coordinate.longitude)
}
In build phases, "Link Binary With Libraries" has CoreLocation.framework selected.
The proper privacy in plist is present: Privacy - Location Usage Description as is Privacy - Location When In Use Usage Description.
The location is still not being gotten. I am using simulator in Xcode 9.4.1 targeting iOS 11. What am I missing here?