I've used this code to get my position and it is normally logged so I can see it works.
Code:
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
if (startingPoint == nil)
self.startingPoint = newLocation;
NSString *latitudeString = [[NSString alloc] initWithFormat:@"%g°", newLocation.coordinate.latitude];
NSLog(@"%@", latitudeString);
self.myLatitude = latitudeString;
[latitudeString release];
NSString *longitudeString = [[NSString alloc] initWithFormat:@"%g°", newLocation.coordinate.longitude];
NSLog(@"%@", longitudeString);
self.myLongitude = longitudeString;
[longitudeString release];
}
But I need to use my position with a webservice, so I logged the two variables on viewLoad, but they are always (null).
Can someone suggest me how can I access the two coordinates
outside the didUpdateToLocation method?
Thanks in advance.