英文:
it is possible to get incoming call number from in iOS and display caller name
问题
我想要的是在来电时获取呼叫者的电话号码,并请求API只为这个特定号码获取数据,因为我无法在应用程序中保存数百万个号码。
英文:
Currently I am using the call Directory Extension with this simple code to show the caller name on the screen and it's working:
class CallDirectoryHandler: CXCallDirectoryProvider, CXCallDirectoryExtensionContextDelegate {
func requestFailed(for extensionContext: CXCallDirectoryExtensionContext, withError error: Error) {
}
override func beginRequest(with context: CXCallDirectoryExtensionContext) {
context.delegate = self
context.addIdentificationEntry(withNextSequentialPhoneNumber: 92302XXXXXXX, label: "XYZ")
context.completeRequest()
}
}
Expected
What I want is on incoming call to get the phone number of who's calling and request the API to get data for this specific number only because it's not possible for me to save millions of numbers on the application.
答案1
得分: 2
Paulw11指出,你描述的情况是不可能的。应用程序在获取用户电话通话方面受到极大限制。然而,一个更常见的方法是提供一个目录服务,如GAL、CardDAV或LDAP。然后,用户将其添加为一个联系人账户(设置 > 邮件、联系人、日历 > 添加账户 > 其他),系统将在需要时自动进行查找。可以通过配置文件提供账户,以便用户无需手动输入信息。
英文:
As Paulw11 notes, what you're describing is not possible. Apps are intentionally extremely limited in what information they can get about user phone calls. However, a more common approach would be to provide a directory service, such as GAL, CardDAV, or LDAP. The user would then add that as a Contacts account (Settings > Mail, Contacts, Calendars > Add Account > Other), and the system will automatically perform lookups when needed. Accounts can be provided via a configuration profile so that the user doesn't have to hand-enter the information by hand.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论