contactsViewController

contactsViewController

我正在使用它来显示联系人详细信息,并且可以选择编辑联系人:

let toFetch = [CNContactViewController.descriptorForRequiredKeys()]
let cnContact = try contactStore!.unifiedContact(withIdentifier: contanctIdentifier, keysToFetch: toFetch)

let contactsViewController = CNContactViewController(for: cnContact)
contactsViewController.delegate = self
contactsViewController.allowsEditing = true

但是我想显示编辑屏幕而不显示联系人详细信息。

最佳答案

只需将CNContactViewController(for:cnContact)更改为

让cvc = CNContactViewController(forNewContact:contact)它会工作

let contactsViewController = CNContactViewController(forNewContact: cnContact)
contactsViewController.delegate = self
contactsViewController.allowsEditing = true

10-06 00:37