如何通过应用程序打开添加联系人表单
How to open Add Contact form through app
如何使用 Contacts Framework
.
打开带有一些预填数据的本机联系人表单
添加 ContactsUI 框架。将其导入您的 viewcontroller 中,像这样
import ContactsUI
从各自的 viewcontroller.
添加并调用以下方法
func addExistingContact() {
if #available(iOS 9.0, *) {
let contactPicker = CNContactPickerViewController()
contactPicker.delegate = self
self.presentViewController(contactPicker, animated: true, completion: nil)
} else {
// Fallback on earlier versions
}
}
如何使用 Contacts Framework
.
添加 ContactsUI 框架。将其导入您的 viewcontroller 中,像这样
import ContactsUI
从各自的 viewcontroller.
添加并调用以下方法 func addExistingContact() {
if #available(iOS 9.0, *) {
let contactPicker = CNContactPickerViewController()
contactPicker.delegate = self
self.presentViewController(contactPicker, animated: true, completion: nil)
} else {
// Fallback on earlier versions
}
}