[英]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.