7

I've just implemented CallKit into our VOIP app but I'm struggling with getting the incoming call UI to show up.

In my experiment I just created a simple method that should show the incoming call UI, see below:

CXProviderConfiguration * configuration = [[CXProviderConfiguration alloc] initWithLocalizedName:@"Bitcall"];
CXProvider *callkitProvider = [[CXProvider alloc] initWithConfiguration: configuration];
[callkitProvider setDelegate:self queue:nil];
CXCallUpdate *update = [[CXCallUpdate alloc] init];
update.localizedCallerName = @"Ravadam Patel";
[callkitProvider reportNewIncomingCallWithUUID:[NSUUID UUID]  update:update completion:^(NSError * _Nullable error) {
    if (error) {
        NSLog(@"Error: %@", error);
    }
}];

Everything seems to be working fine and I actually get a call received print out with this code:

- (void)handleCall
{
  self.callCenter.callEventHandler = ^(CTCall *call){

    if ([call.callState isEqualToString: CTCallStateConnected])
    {
      //NSLog(@"call stopped");
    }
    else if ([call.callState isEqualToString: CTCallStateDialing])
    {
    }
    else if ([call.callState isEqualToString: CTCallStateDisconnected])
    {
      NSLog(@"Call ended");
    }
    else if ([call.callState isEqualToString: CTCallStateIncoming])
    {
      NSLog(@"Call received");
    }
  };
}

But no incoming call UI is shown. Is there something I'm missing?

Thanks

Ismailp
  • 2,333
  • 4
  • 37
  • 66
  • 2
    Could it be that CallKit doesn't work in the sim? – Ismailp Sep 21 '16 at 10:17
  • could you help me to where to get CallKit integration to VoIP app with Objective-c, im search from few days, but couldn't found. But, if you have, could you share the link. Thanks! – Anilkumar iOS - ReactNative Sep 22 '16 at 07:50
  • 1
    CallKit does not work in the iOS Simulator, in case that is where you are testing. Try running on a device instead. – Stuart M Sep 22 '16 at 18:08
  • I'd recommend comparing your app to the sample code app [Speakerbox](https://developer.apple.com/library/content/samplecode/Speakerbox/Introduction/Intro.html) published by Apple to see if there are any pieces missing from your implementation – Stuart M Sep 22 '16 at 18:09
  • 1
    @StuartM You are correct. The code works just fine! Please add your comment as an answer and I'll accept it. – Ismailp Sep 22 '16 at 23:33
  • @AnilkumariOSdeveloper I will post a Gist for you to view later after I've implemented all parts. But if you look at the documentation it's pretty clear even if there aren't any code examples in obj-c. – Ismailp Sep 25 '16 at 21:53
  • When your code in AppDelegate.m then it works – MD SHAHIDUL ISLAM Feb 09 '17 at 08:07

1 Answers1

12

CallKit does not work in the iOS Simulator, so your app will need to be run on a device instead.

Also, I recommend comparing your app to the sample code app Speakerbox published by Apple to see if there are any pieces missing from your implementation.

Stuart M
  • 11,458
  • 6
  • 45
  • 59
  • @Stuart M, do you have code in objective-c for callkit example? – Anilkumar iOS - ReactNative Sep 26 '16 at 05:50
  • @AnilkumariOSdeveloper Unfortunately no, but all functionality demonstrated in the Swift [Speakerbox](https://developer.apple.com/library/content/samplecode/Speakerbox/Introduction/Intro.html) sample app is available from Objective C, just needs to be translated – Stuart M Sep 26 '16 at 05:54