Search code examples
iosgpslocationcountrycarrier

How to get user country without internet and gps (may be Carrier?) in iOS


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?


Solution

  • 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];