xcode 如何识别Iphone来电并显示通知?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10054706/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
how to identifying Iphone incoming call and display notification?
提问by
i need to create application like identify incoming call in iphone and check that incoming call number in our database. then want to display notification what information stored in database for that particular number. These all functions want run when user receiving call.
我需要创建应用程序,例如在 iphone 中识别来电并检查我们数据库中的来电号码。然后想要显示通知,该特定号码的数据库中存储了哪些信息。这些所有功能都希望在用户接到电话时运行。
is this possible ?
这可能吗 ?
采纳答案by jmstone617
You probably want to start your search in CoreTelephony. That being said, if a call comes in, iOS's call-handling events will take over your app. In other words, your app will be suspended when the call comes in, and move back to the foreground when the call is complete. You can use CoreTelephony to get access to the CTCallCenter, which contains an array of CTCalls (calls in progress). CTCall does not contain the phone number for the call, to my knowledge though. Furthermore, you can't stop iOS from backgrounding your app to handle the call.
您可能想在CoreTelephony 中开始搜索。话虽如此,如果有电话进来,iOS 的呼叫处理事件将接管您的应用程序。换句话说,您的应用程序将在呼叫进入时暂停,并在呼叫完成时移回前台。您可以使用 CoreTelephony 访问 CTCallCenter,其中包含一组 CTCall(正在进行的呼叫)。据我所知,CTCall 不包含通话的电话号码。此外,您无法阻止 iOS 后台处理您的应用程序来处理呼叫。