问题
I want to get user country without internet connection and GPS
.
I tried getting user's Country using Carrier information
(CTTelephonyNetworkInfo *info = [CTTelephonyNetworkInfo new];
CTCarrier *carrier = info.subscriberCellularProvider;),
but this provides Carriers original location, not Active country.
For example if the user has AT&T
sim card and he is in France, I get U.S.
Any suggestions?
回答1:
You can try getting the User's TimeZone city by checking the timeZone selected on the device and then translate that to the country by using a local database on the device . Give this a try
NSTimeZone *timeZone = [NSTimeZone localTimeZone]; // or try [NSTimeZone systemTimeZone];
NSString *timeZoneName = [timeZone name];
来源:https://stackoverflow.com/questions/25383585/how-to-get-user-country-without-internet-and-gps-may-be-carrier-in-ios