The iPhone/iPodTouch non-gps geoLocation engine is provided by Skyhook Wireless . They have driven most roads in most cities with their geoLocation vans to plot wifi points against GPS and it is primarily this data that the iPhone uses to get its fixes.
Its also interesting to note that Skyhook uses the iPhone to "self heal" its access point database. If they receive a point which is not in their database, or thought to be elsewhere they refine the data.
I've spoken to a Kate Imbach of Skyhook about this technology a few times, and I'm surprised that they don't use GPS in combination with WiFi triangulation in order to improve mapping data, but it seems this is not the case.
That said, the specific methods part of your question is a different story: the iPhone SDK abstracts all of this from you.
You simply need to import the CoreLocation framework into your project, adopt the CLLocationManagerDelegate protocol
Then instantiate a Locationmanager
CLLocationManager * LM = [[CLLocationManager alloc] init];
[[self locationManager] setDelegate:self];
[[self locationManager] setDesiredAccuracy:kCLLocationAccuracyBest];
[[self locationManager] startUpdatingLocation];
You can then query your locationManager or receive updates to
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{
NSLog(@"Location changed!");
}
- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error{
}
That should get you going!