Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Determine iPhone user's country

I need to determine at startup what country a user is in, for an iPhone application. Presumably I will have to turn on location services and do some sort of reverse geocoding. I don't really want to use a third party web service if possible, are there any other suggestions for determining country from what location services provides?

Initially, I only need to check whether the user is inside the US or not, but this may change in the future to add more countries. I understand that location can not always be determined or the user may have location services turned off. Basically, I just need to know if the user is detected as being inside the US, in order to turn off a specific feature.

EDIT: On further reading, it looks like MKReverseGeocoder would be the way to go, except I don't wish to display any maps in my app, which means I'm not allowed to use this.

like image 954
Ben Williams Avatar asked Jun 15 '10 07:06

Ben Williams


People also ask

How do I know which country my iPhone belongs to?

Go to Settings > General > About > ModelLook for the two letters before the slash (/) because that is significant to find out the country of origin of your iPhone. If the last two letters before the slash are 'LL' (see image below) then your iPhone's country of origin is USA.

How can I know my iPhone is Indian or not?

Choose Settings, General, and then About, and find the model number. An Indian iPhone will have HN just before the slash. If the model number has HN before the "/" then its an Indian model.

Can I track my iPhone in another country?

Find My iPhone works abroad the same way it does at home, and you can access it via icloud.com or the Find My iPhone app on a friend's iPhone. If your phone is on and has signal, you'll be able to view its location, play a sound on it, or put it in Lost Mode.


1 Answers

Another trick you can try is checking the carrier’s MCC:

#import <CoreTelephony/CTTelephonyNetworkInfo.h> #import <CoreTelephony/CTCarrier.h>  CTTelephonyNetworkInfo *netInfo = [[CTTelephonyNetworkInfo alloc] init]; CTCarrier *carrier = [netInfo subscriberCellularProvider]; NSString *mcc = [carrier mobileCountryCode]; 
like image 165
zoul Avatar answered Oct 13 '22 22:10

zoul