我是一名 iOS 开发者。
最近我被告知需要从中国地区的应用程序中删除Callkit。但我不能只发布一个没有 Callkit 的中文版本,与原始应用程序分离。因为我们的服务器端已经卖给客户了,所以我无法一一修改他们的苹果推送证书。所以我需要在运行时识别中国地区。
使用位置不是一个好主意,因为我们的应用程序与用户的位置无关,并且可以在设置中轻松关闭它。是否有可能在运行时知道我的应用程序最初是从 App Store 的哪个区域下载的?
谢谢你。
检查语言环境怎么样?这听起来很愚蠢而且很容易规避,但它可能足以满足中国的法律要求...... 类似以下内容:
// 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];
}
从 storekit 检查店面
#import <StoreKit/StoreKit.h>
SKStorefront *store = [[SKPaymentQueue defaultQueue] storefront];
if ([store.countryCode isEqualTo:@"CHN"]) {
// is China
}