How to get roaming status in IOS

Rana picture Rana · Jul 17, 2013 · Viewed 7.8k times · Source

I want to get notified when I enter in roaming area in my iOS app, I have already read the documentation for NSLocale , SCNetworkReachability , and core telephony (I may have missed something). I need to get this info from sim (or any other way if possible).

Answer

Gordon Dove picture Gordon Dove · Oct 2, 2014

The usual method would be to get the carrier's country code from the core telephony interface and then compare that with the country code from reverse geocoding the location.

Advantages: works with VPNs and when the user has disabled data when roaming. Disadvantages: doesn't work without location.

I don't have any non-copyright code for you, but the key you need in the place marks dictionary you need for country code is @"CountryCode" Geocoding would be something like:-

CLGeocoder* geocoder = [[CLGeocoder alloc] init];
[geocoder reverseGeocodeLocation:location completionHandler: ^(NSArray* placemarks){}]

The country code for the provider would be

NSString* homeCountry = [netInfo.subscriberCellularProvider isoCountryCode];

Hope this helps