Выполните следующие действия:
Добавьте MapKit.framework в ваш проект
добавьте в .h #import "CoreLocation / CoreLocation.h"and #import" MapKit / MapKit.h "
Использовать делегатов как, @interface yourInterface: UIViewController
сейчасДобавьте следующий метод в ваш файл .m
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
[self setMapCenter:newLocation.coordinate];
[self._mapView selectAnnotation:[[self._mapView annotations] lastObject] animated:YES];
lblLong.text = [nsstring stringWithFormat:@"%f", newLocation.coordinate.longitude];
lblLat = [nsstring stringWithFormat:@"%f", newLocation.coordinate.latitude];
[self.locationManager stopUpdatingLocation];
}
-(void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
{
NSLog(@"ERROR");
}
Здесь упомяните CLLocationManager *locationManager;
.удачи.