简体   繁体   中英

CoreTelephony framework available for Facetime too?

I'm develloping an app that works with facetime. Unfortunatly, there is not yet Facetime frameworks or APIs available, so I'm working with what I have. Like you all must know, when a Facetime call is placed, the native Phone app does the job. The only problem is that when the call is over, it stays in there.

What I want to do is to, once the call ended, send a local notification to the user to ask if he wants to get back to my app, all this with the help of CoreTelephony framework. I know it is a work-in-progress framework and that it's still a private one, BUT:

Can I use that framework in my app and publish it, without been rejected by Apple?

Does that framework works for Facetime too? I can't get it work. Here is what I did:

  • I first imported the framework in my appDelegate header file
  • And then...

.

- (void)applicationDidEnterBackground:(UIApplication *)application{
 NSLog(@"applicationDidEnterBackground");


CTCallCenter *callCenter = [[CTCallCenter alloc] init];
 callCenter.callEventHandler=^(CTCall* call){

  if (call.callState == CTCallStateDialing){ 
   NSLog(@"Call Dialing");
  }
  if (call.callState == CTCallStateConnected){ 
   NSLog(@"Call Connected");
  }
  if (call.callState == CTCallStateDisconnected){ 
   NSLog(@"Call Disconnected");
  }
 };
}

Nothing gets traced. Any ideas?

Update: I just run a little test, I figured out that my code works perfectly with an actual phone call. The CTCallCenter block must be placed in the applicationDidBecomeActive method tho. I also realized that (like the Apple documentation says), the frameworks dispatches those notification only when you're in your app. Suspended mode doesn't get any kind of notification.

There's a new CallKit SDK in iOS 10 that allows for detecting of VoIP calls (including FaceTime) even without VoIP entitlements. Here's a great answer explaining how just to use the observer part.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM