-( void )locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations { //此处locations存储了持续更新的位置坐标值,取最后一个值为最新位置,如果不想让其持续更新位置,则在此方法中获取到一个值之后让locationManager stopUpdatingLocation CLLocation *currentLocation = [locations lastObject]; CLLocationCoordinate2D coor = currentLocation.coordinate; self.latitude = coor.latitude; self.longitude = coor.longitude; //[self.locationManager stopUpdatingLocation]; } |
|