First add explicitly that you confirm CLLocationManagerDelegate:
class LoginViewController: UIViewController, CLLocationManagerDelegate
Second, set the delegation property to CLLocationManager:
override func viewDidLoad() {
super.viewDidLoad()
locationManager.delegate = self
ref = FIRDatabase.database().reference()
}
Thirdly, in the CLLocationManagerDelegatedoc, I see a difference from your method declaration didUpdateLocationsand didFailWithError:
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation])
func locationManager(_ manager: CLLocationManager, didFailWithError error: NSError)
, . . ! . , . , . loginDidTouch :
var latitude: Double? = location?.coordinate.latitude
var longitude: Double? = location?.coordinate.longitude
, ( , ), . didUpdateLocations:
if let pm = placemarks?.first
{
self.displayLocationInfo(pm)
}
, , - placemarks , placemarks ,