我是Google Map SDK的新手,我实现了CLLocationManagerDeletage
的可选功能:
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation])
{
guard let location = locations.first else {
return
}
print(location) //this code is what I want.
viewMap.camera = GMSCameraPosition(target: location.coordinate, zoom: 15, bearing: 0, viewingAngle: 0)
locationManager.stopUpdatingLocation()
}
但是它不会打印位置。