Search code examples
ioscore-location

Get device location (only country) in iOS


I need to get the country location of a iOS device.

I've been trying to use CoreLocation with MKReverseGeocoder. However this seems to return erraneous quite frequently. And I only need the country, no need for streets and such.

How can this be done in a more stable way?


Solution

  • NSLocale is just a setting about currently used regional settings, it doesn't mean the actual country you're in.

    Use CLLocationManager to get current location & CLGeocoder to perform reverse-geocoding. You can get country name from there.