1

I'm an iOS developer.

Recently I was informed that I need to remove Callkit from my app in China region. But I can't just release a Chinese version without Callkit that separated from the original app. Because our server end has already been sold to customers, I am not able to alter the apple push certificate for them one by one. So I need to identify the China region in runtime.

Using location is not a good idea since our app has nothing to do with user's location and it can be easily turned off in settings. Is it possible to know the region of App Store that my app was originally downloaded from in runtime?

Thank you.

steven
  • 1,237
  • 2
  • 11
  • 13
  • Probably the only way you can do it is to check the public in address of the device; if it maps to China then disable the Callkit features. – Paulw11 Jun 27 '18 at 10:00

1 Answers1

1

What about checking the locale region? It sounds stupid and very easy to circumvent but it might be good enough to fulfil the chinese legal requirements... Something in the lines of:

// Chinese country codes
NSString *const MacauChinaCountryCode = @"MO";
NSString *const ChinaCountryCode = @"CN";
NSString *const HongKongChinaCountryCode = @"HK";

...

- (BOOL)isRegionSupportedByCallKit {
    NSString *currentCountryCode = [NSLocale currentLocale].countryCode;
    NSArray<NSString *> *chineseCountryCodes = @[MacauChinaCountryCode, ChinaCountryCode, HongKongChinaCountryCode];
    return ![chineseCountryCodes containsObject:currentCountryCode];
}
txulu
  • 1,602
  • 16
  • 26
  • Thank you for reply. Can locale region be manually set in iOS settings? I'm not sure Apple will approve this... – steven Jul 10 '18 at 05:54
  • I'm currently using the carrier country code from [here](https://stackoverflow.com/questions/33508441/swift-2-country-code-for-a-phone-number/33508661#33508661). But I'm expecting tons of complains about this change. It would be better if users could have a detour. – steven Jul 10 '18 at 06:06
  • Yes, it can be set very easily. But it will already be the user circumventing it on its own, from the legal perspective it might be enough... – txulu Jul 16 '18 at 09:54