Accessing Lon/Lat/Alt

I could access Lon/Lat/Alt values from iPhone’s Location Manager class. This is kind neat. I got exact same value that I put my apartment address in google map. When I run this on the simulator, it always returns a address in Santa Clara. Is this Apple’s company building address or something? Let me know if anyone familiar with the address below.

Lon Lat on Simulator Simulator generates values

Download the source code from here



@interface LocationSampleViewController : UIViewController {
	IBOutlet UILabel *mLabel;
	CLLocationManager *locationManager;




#import "LocationSampleViewController.h"

@implementation LocationSampleViewController

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];

	locationManager =  [[CLLocationManager alloc] init];
    locationManager.delegate = self;
    locationManager.distanceFilter = 1000;  // 1 kilometer
    locationManager.desiredAccuracy = kCLLocationAccuracyKilometer;
    [locationManager startUpdatingLocation];


- (void)didReceiveMemoryWarning {
	// Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];

	// Release any cached data, images, etc that aren't in use.

- (void)viewDidUnload {
	// Release any retained subviews of the main view.
	// e.g. self.myOutlet = nil;

- (void)dealloc {
    [super dealloc];

#pragma mark location methods
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{
	mLabel.text = [NSString stringWithFormat:@"%f,%f,%f",newLocation.coordinate.latitude,newLocation.coordinate.longitude,newLocation.altitude];
	[locationManager stopUpdatingLocation];

- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error{
	mLabel.text = @"error";

By: kiichi on: