views:

386

answers:

1

Hello im trying to get the latitude and longitude values where the the location of the user is without having the map show up so basically it will run on the background. I guess i have to use the map kit but are there any examples?

+2  A: 

If you don't want a map, you don't need MapKit. Just use CLLocationManager.

- (id) init {
  if (self = [super init]) {
    locationManager = [[CLLocationManager alloc] init];
    [locationManager setDelegate:self];
    [locationManager startUpdatingLocation];
  }
  return self;
}

- (void) locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)location fromLocation:(CLLocation *)oldLocation {
  NSLog(@"lat:%f lon:%f", location.coordinate.latitude, location.coordinate.longitude);
}
mckeed