location - iOS - Determine User's country without using CLLocationManager -


i don't need precise location data, , don't want user see "this app wants determine location" alert. need determine user's country, assuming have internet connection via network or wi-fi.

what best way this? there way use ip?

this work if had carrier:

cttelephonynetworkinfo *netinfo = [[cttelephonynetworkinfo alloc] init]; ctcarrier *carrier = [netinfo subscribercellularprovider]; nsstring *mcc = [carrier mobilecountrycode]; 

and nslocale not reliable in user can change in device settings. can't use device's language setting same reason. need country based on physically located.

you user's ip address , use geolocation database guess location based on described here: https://en.wikipedia.org/wiki/ip_address_location . if concerned region, can find data @ regional internet registries (https://en.wikipedia.org/wiki/regional_internet_registry) websites you, since control ip addresses particular region.


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -