To get the users country we have to do the following.
First instantiate the NSLocale to get the current information from the device.
Then get the country code
Then we create a variable that translate the country code into a string with the name of the country such as “US”, “GB” etc.
With the code above we are checking if the user is in the US. If the user is not in the US then we return a string with “User is outside the US”. In my current project we use this to determine whether we want to display metric, or imperial based on the users country.
A little secret about NSLocale
When the user travels outside their home country the locale does not change. The locale is based on the users settings, not their location.