简体   繁体   English

CoreTelephony框架也可用于Facetime吗?

[英]CoreTelephony framework available for Facetime too?

I'm develloping an app that works with facetime. 我正在开发可与Facetime配合使用的应用程序。 Unfortunatly, there is not yet Facetime frameworks or APIs available, so I'm working with what I have. 不幸的是,还没有可用的Facetime框架或API,因此我正在使用现有的东西。 Like you all must know, when a Facetime call is placed, the native Phone app does the job. 就像大家都知道的那样,当发起Facetime呼叫时,本地Phone应用程序会完成这项工作。 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. 我想要做的是,在通话结束后,在CoreTelephony框架的帮助下,向用户发送本地通知,询问他是否要返回我的应用程序。 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? 我可以在我的应用程序中使用该框架并发布它,而不会被Apple拒绝吗?

Does that framework works for Facetime too? 该框架也适用于Facetime吗? I can't get it work. 我无法正常工作。 Here is what I did: 这是我所做的:

  • I first imported the framework in my appDelegate header file 我首先将框架导入了我的appDelegate头文件中
  • 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. 必须将CTCallCenter块放置在applicationDidBecomeActive方法tho中。 I also realized that (like the Apple documentation says), the frameworks dispatches those notification only when you're in your app. 我还意识到(如Apple文档所述),框架仅在您使用应用程序时才调度这些通知。 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. iOS 10中有一个新的CallKit SDK,即使没有VoIP授权,它也可以检测VoIP呼叫(包括FaceTime)。 Here's a great answer explaining how just to use the observer part. 这是一个很好的答案,解释了如何仅使用观察者部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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