在ios中检测呼叫事件 [英] Detecting the call events in ios

查看:180
本文介绍了在ios中检测呼叫事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是ios的新手。我想知道是否有任何方法可以检测到呼叫事件,如来电,即使我的应用程序不在前台,即时呼叫。如果是的话,我可以读取有关该电话的详细信息,如持续时间,无论是错过,拨打还是接收。感谢提前。

解决方案

是的,您可以检测到一个电话。但只有当您的应用程序在前台运行时。
为此,您可以使用核心电话框架



如果您的应用程序属于任何后台运行类别(VOIP,AUDIO,位置跟踪或附件),您可能可以使用
CTCallCenter 。但是请注意,如果您错过使用背景运行模式,Apple将拒绝您的应用程序。



CTCallCenter 将允许您检测任何已启动或正在进行的呼叫。



但是,您将无法检测到有关该呼叫的任何详细信息, CTCall 识别通话只会告诉你这个状态。 callID CTCall 只会为您提供唯一的呼叫标识符,但不会调用该号码。


I am new to ios. I was wondering if there is any way to detect the call events like incoming call, outgoing call even if my app is not in foreground. And if yes it is possible then can i read the details about that call like duration, whether it is missed, dialed or recieved. Thanks in advance.

解决方案

Yes you can detect a Call. but only if your app is running in the foreground. For this you can use the Core Telephony Framework.

If your app will fall in any of the background running categories (VOIP, AUDIO, Location tracking or accessory ) you might be able to use the CTCallCenter in the background. But be aware that Apple will reject you app if you miss use the background running mode for something it was not meant for.

The CTCallCenter will allow you to detect any calls that are started or already in progress.

However you will not be able to detect any detail about the call, the CTCall identifying the call will only tell you this state. The callID of CTCall will just give you an unique identifier for the call but not the number being called.

这篇关于在ios中检测呼叫事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆