简体   繁体   English

我需要从我的应用程序中访问IOS联系人。

[英]I need to access IOS contacts from within my app.

There does not appear to be a simple url scheme for contacts like the ones for reminders and calendars. 似乎没有一个简单的URL方案用于联系人,例如用于提醒和日历的联系人。 Is anyone aware of a scheme to simply call the contact app from swift code? 有谁知道可以通过快速代码简单地调用联系人应用程序的方案?

I would follow the documentation for the Contacts framework, introduced in iOS 9. Documentation and examples can be found here . 我将遵循iOS 9中引入的Contacts框架的文档。可在此处找到文档和示例。

For instance, you can fetch all contacts containing "Appleseed" in the name with this code: 例如,您可以使用以下代码获取名称中包含“ Appleseed”的所有联系人:

let store = CNContactStore()
let contacts = try store.unifiedContactsMatchingPredicate(CNContact.predicateForContactsMatchingName("Appleseed"), keysToFetch:[CNContactGivenNameKey, CNContactFamilyNameKey])

暂无
暂无

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

相关问题 iOS:我需要将用户的私钥(RSA)转移到我的应用程序。 文件共享是一个好的解决方案吗? - iOS: I need to transfer user's private key (RSA) to my App. Is file sharing a good solution? 如何从我的应用程序访问iPhone联系人? - how can i access iphone contacts from my app? 我想从我的网站获取我的博客文章到我的iOS应用程序。 为此需要什么知识? - I wanna fetch my blogposts from my website, to my iOS app. What knowledge is required to do this? 我想在我的应用程序上使用此文本。 我需要帮助 - I Want to use this Text on My App. I need a hand with it 如何从我的iOS应用程序将图像和文本共享到Facebook。 - How to share an image & text to Facebook from my iOS App. 我的应用程序拒绝访问iOS联系人-Swift - My app keep deny the access to contacts iOS - Swift iOS Swift我无法从我的应用程序中获取我的真实位置。 我总是得到苹果公司的地址 - IOS Swift I can't get my real location from my app. I alway get the Apple Inc address 如何从我的 iOS 应用程序中访问 iCloud Drive 中的文件? - How to access files in iCloud Drive from within my iOS app? 可以从我的应用程序iOS 7中打开“联系人”应用程序 - Is possible to open Contacts app from my app iOS 7 是否需要访问联系人的权限才能将联系人信息从应用程序保存到本机联系人? - Need permission to access contacts to save contact information from app to native contacts?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM