Disabling Callkit from China Store Best Approach?

旧街凉风 提交于 2020-06-27 07:25:10

问题


We are using CallKit framework to benefit native usage for Voip features. Users can make Voice and Video Calls in our Messenger App.

But Apple removing CallKit apps from China, because of Chinese government.

What is the best approach for CallKit apps like us for now?

We do not want to remove our app from China and we do not remove all CallKit functionality from our app because of China..


回答1:


I agree with txulu that it seems that CallKit just needs to be disabled/not used for users in China - see this helpful response on the Apple Developer forums.

The general consensus seems to be that as long as you can explain to App Review how you’re disabling CallKit features for users in China, that should probably be acceptable unless/until Apple publishes specific guidelines.

For your particular problem Ahmet, it sounds like CallKit may provide some of the the core functionality of your app. If this is the case and you really need to support users in China, you might want to look at rebuilding your app using another VOIP framework to make calls (VOIP is still allowed in China...just not using CallKit). Or perhaps you could disable and hide the calling features in your app if the user is in China.

My app was only using CallKit to observe when a call initiated from my app ends, so I was able to devise a work around. For users in China I now observe for the UIApplicationDidBecomeActiveNotification and make my best guess about whether a phone call initiated from the app has ended based on how much time has elapsed since the call began. It's not as good as using CallKit's CXCallObserver, but it seems to work well enough for my purpose.


Update! My app passed App Store review with the fix described.

  • Submitted a new version yesterday.
  • Included a short message in the reviewer info section saying "In this version and onwards, we do not use CallKit features for users in China. We detect the user's region using NSLocale."
  • App was approved around 12hr later without any questions or comments from the App Review team.

Detecting users in China

To determine if a user is in China, I am using NSLocale to get the users' currentLocale and countryCode. If the countryCode contains one of the ISO codes for China (CN, CHN), I set a flag to note I cannot use CallKit and not initialize or use CallKit features in my app.

- (void)viewDidLoad {
    [super viewDidLoad];

    NSLocale *userLocale = [NSLocale currentLocale];
    if ([userLocale.countryCode containsString: @"CN"] || [userLocale.countryCode containsString: @"CHN"]) {
        NSLog(@"currentLocale is China so we cannot use CallKit.");
        self.cannotUseCallKit = YES;
    } else {
        self.cannotUseCallKit = NO;
        // setup CallKit observer
        self.callObserver = [[CXCallObserver alloc] init];
        [self.callObserver setDelegate:self queue:nil];
    }
}

To test this, you can change the region in Settings > General > Language and Region > Region. When I set Region to 'China' but left language set as English, [NSLocale currentLocale] returned "en_CN".




回答2:


One thing you could try, even though it may not work: disable callkit functionality based on the locale region. This may be enough "proof" that Callkit is disabled for China from the legal perspective in order to be approved for the Appstore. Then your Chinese customers could just switch the region in the settings to get Callkit. This would be already "their" problem so to speak.

Disclaimer: I'm by no means a lawyer or anything, follow this advice at your own risk.




回答3:


Edit: CXProvider.isSupported is no longer available: I keep the answer here hoping that it will be restored back on an upcoming iOS 13 release.

From iOS 13 onwards, the correct way to do this is to check the new CXProvider.isSupported property.

Here's the documentation (from Xcode, as the online documentation has not been updated yet):




回答4:


Swift 5

func isCallKitSupport() -> Bool {
    let userLocale = NSLocale.current

    if userLocale.regionCode?.contains("CN") != nil ||
        userLocale.regionCode?.contains("CHN") != nil {

        return false
    } else {
        return true
    }
}


来源:https://stackoverflow.com/questions/51016603/disabling-callkit-from-china-store-best-approach

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!