Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disabling Callkit from China Store Best Approach?

Tags:

ios

callkit

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..

like image 783
Ahmet Kazim Günay Avatar asked Jun 25 '18 05:06

Ahmet Kazim Günay


People also ask

How do I turn off CallKit on my Iphone?

A user can disable CallKit integration on their device by tapping their avatar, selecting Settings, and then toggling Mobile Integration to off (default is on). This cannot be done if CallKit is disabled for the user's tenant.

What is CallKit functionality?

Tag: CallKit The Amazon Chime SDKs for iOS and Android allow application developers to integrate real time audio, video and screen share functionality into their iOS and Android applications.


1 Answers

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".


Swift 5

Utility Functions

func isCallKitSupported() -> Bool {
    let userLocale = NSLocale.current
    
    guard let regionCode = userLocale.regionCode else { return false }
    
    if regionCode.contains("CN") ||
        regionCode.contains("CHN") {
        return false
    } else {
        return true
    }
}

MainViewController

class MainViewController: UIViewController {
  ...
  var callObserver = CXCallObserver()
  ...
  override func viewDidLoad() {
    super.viewDidLoad()
    if isCallKitSupported() {
      callObserver.setDelegate(self, queue: nil)
    }
    ...
  }
  ...
}

Note: countryCode is now regionCode and only returns 'US', 'CN', etc. No language before country code like 'en_CN'.

like image 50
Natalia Avatar answered Sep 23 '22 15:09

Natalia