如何从 iPhone 上的来电中获取来电者的电话号码
你好,我想构建一个应用程序,在来电时执行某些操作。但我认为手机需要在 iPhone 上越狱才能访问执行此操作的类。我想在手机不越狱的情况下做到这一点。
Hi I want to build an app that does something when an incoming call comes in. But I think that the phone needs to be jailbroken on the iphone to access the class that does that. I want to do it without the phone being jailbroken.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不可能。
但是,您可以使用 CoreTelephony 框架。
Not possible.
However you may get the information like call state(connected/disconnected etc) using CoreTelephony framework.
如果您想在来电或去电时执行任何操作,则必须使用此代码:
但是当您的应用程序处于活动状态或从后台转到前台时,这将起作用。如果应用程序将杀死或暂停该应用程序,则该应用程序将不起作用。首先,您检测呼叫状态,然后立即显示本地通知。当单击查看详细信息时,再次显示您的应用程序。但这并没有得到苹果的批准,因为它会在后台发送电话。所以可能会有风险。
If you want to do anything when a call come or going then you have to use this code:
but that will work when u app will active or go background to foreground. If app will kill or suspended the that will not work. First you detect state of call and then show a local notification immediately. And when click on view details then show ur app again. But this is not approved by apple because it will send phone call in background. So it may be risky.