Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

alexandergre

macrumors member
Original poster
Jul 28, 2009
58
0
xAppDelegate.h
Code:
NSNumber *currentLatitude;
NSNumber *currentLongitude;
CLLocationManager *locationManager;

xAppDelegate.m
Code:
- (void)applicationDidFinishLaunching:(UIApplication *)application {
	
	
	CLLocation *location = [locationManager location];
	CLLocationCoordinate2D coordinate = [location coordinate];
	currentLongitude = [NSNumber numberWithDouble:coordinate.longitude];
	currentLatitude = [NSNumber numberWithDouble:coordinate.latitude];
	
	NSLog([NSString stringWithFormat:@"%@ , %@", currentLatitude, currentLongitude]);
	
	
	[window addSubview:[navigationController view]];
	[window makeKeyAndVisible];
}

tested the code on iPhone 3gs
and the debugger gives me:
0 , 5.862950985069642e-37

what is wrong?
thanx
 
Most likely nothing is wrong: you should be giving an accuracy you desire and registering for updates from CL. The documentation (which you should have read) says:

"To use a CLLocationManager object to deliver location events, create an instance, assign a delegate object to it, configure the desired accuracy and distance filter values, and call the startUpdatingLocation method. The location service returns an initial location as quickly as possible, returning cached information when available. After delivery of the initial event notification, the CLLocationManager object may deliver additional events if the minimum threshold distance (as specified by the distanceFilter property) is exceeded or a more accurate location value is determined."
 
Most likely nothing is wrong: you should be giving an accuracy you desire and registering for updates from CL. The documentation (which you should have read) says:

"To use a CLLocationManager object to deliver location events, create an instance, assign a delegate object to it, configure the desired accuracy and distance filter values, and call the startUpdatingLocation method. The location service returns an initial location as quickly as possible, returning cached information when available. After delivery of the initial event notification, the CLLocationManager object may deliver additional events if the minimum threshold distance (as specified by the distanceFilter property) is exceeded or a more accurate location value is determined."

thanx a lot.
problem resolved :D:D:D::D:D
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.