Delegate must respond to locationManager:didUpdateLocations swift eroor

You are using xcode8 and swift3 but your delegate methods are copied from swift 2.Change your delegate methods as below.

extension ViewController : CLLocationManagerDelegate {

    func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) {
         print("error:: \(error.localizedDescription)")
    }

    func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus) {
        if status == .authorizedWhenInUse {
            locationManager.requestLocation()
        }
    }

    func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {

        if locations.first != nil {
            print("location:: (location)")
        }

    }

}

It's possible to get this error if you request the location to the location manager and it's delegate is nil. Make sure that you always set the delegate before calling to any location request.

For example, set the delegate first:

locationManager.delegate = self

Before requesting the location:

locationManager.requestLocation()

import UIKit
import CoreLocation

class ViewController: UIViewController {
    
    let locationManager = CLLocationManager()

    override func viewDidLoad() {
        
        super.viewDidLoad()

        locationManager.delegate = self        
        locationManager.requestWhenInUseAuthorization()
        locationManager.requestLocation()
    }
}

extension ViewController : CLLocationManagerDelegate {
    func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
        if let location = locations.first {
            print("Location data received.")
            print(location)
        }
    }
    func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) {
        print("Failed to get users location.")
    }
}

The delegate needs to be assigned before calling the requestLocation() function because after the requestLocation() is completed it will trigger didUpdateLocations, but to call didUpdateLocations it should know which object didUpdateLocations is being called. To clarify that to the compiler
locationManager.delegate = self is used to before the locationManager.requestLocation() call is made.

In the extension of CLLocationManagerDelegate protocol implement didUpdateLocations and didFailWithError.