CLLocationManager didUpdateToLocation, bring values to a NSString to use elsewhere!
Using NSLog(@"%@",longi) outside this function crashes my application.... How can I use this NSLog outside the didUpdateToLocation function? Like in a IBAction function.
This example works great! But How to use this NSLogs outside this one?
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
longi = [[NSString alloc] initWithFormat:@"%g", newLocation.coordinate.longitude];
lati = [[NSString alloc开发者_JS百科] initWithFormat:@"%g", newLocation.coordinate.latitude];
NSLog(@"%@",longi);
NSLog(@"%@",lati);
}
You can store this values in NSUserDefaults and access them whenever needed.
精彩评论