How to spoof different carriers in iOS?

298 views Asked by At

Is it possible to spoof network providers just like it is possible to spoof locations in iOS?

I have an app that will get a user's ISO country code using Core Location, however I would like a fallback for when the user doesn't authorize location services for my app.

I have a function that is called in order to set a user's country according to their carrier; see below.

- (void)carrierBasedLocationSet {
if (DefaultCountryCode && ![DefaultCountryCode isEqualToString:@"Default"]) {
    ////NSLog(@"Skip Carrier Based Location set : DefaultCountryCode is [%@]", DefaultCountryCode);
    return;
}
/***********************************
 * Set country code based on Carrier
 ***********************************/
CTTelephonyNetworkInfo *networkInfo = [[CTTelephonyNetworkInfo alloc] init];
Carrier = [networkInfo subscriberCellularProvider];
NSString *isoCountryCode = Carrier.isoCountryCode;
if (isoCountryCode == nil || isoCountryCode.length == 0) {
    isoCountryCode = [[NSLocale currentLocale] objectForKey:NSLocaleCountryCode];
}
self.ISO_CountryCode = [isoCountryCode uppercaseString];
self.CarrierBased_ISO_Country = self.ISO_CountryCode;

}

This code works and produces US, which is where I am located. However, I want to test this out for different countries. Simply editing the product scheme to spoof a location in Australia, for example, does not give me back the AU country code and still gives me US.

Does anyone know if what I am trying to do is possible? Getting a user's location is essential to my application and I am unsure of another alternative.

0

There are 0 answers