I'm developing an app to get the current location either when cellular data is off or when WiFi is not connected.
I used the following code, but I got only latitude and longitude not location with address.
so I need guidance to implement it.
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
NSLog(@"didUpdateToLocation: %@", newLocation);
CLLocation *currentLocation1 = newLocation;
if (currentLocation1 != nil)
{
strLet=[NSString stringWithFormat:@"%f",currentLocation1.coordinate.latitude];
strLong=[NSString stringWithFormat:@"%f",currentLocation1.coordinate.longitude];
NSLog(@"%f",currentLocation1.coordinate.longitude);
NSLog(@"%f",currentLocation1.coordinate.latitude);
}
}
Thanks.
For your information, by using GPS, we can get current location without active internet connection, but it
(1) takes a long time to get position and (2) doesn't work properly inside buildings or streets
--- UPDATE (as question updated) ---
By using apple's native iOS API, you can do reverse geocoding by using MKReverseGeocoder (available in MapKit framework) or CLGeocoder (available in CoreLocation framework).
But, this require working internet connection for getting data from server.
So, you can't do reverse geocoding without internet connection using native iOS APIs.
However, by using following third party libraries, you can get limited available address information (Country Name and ISO Code):
IOS-Offline-GeoCoder
ios-offline-reverse-geocode-country,