WhatsApp와 같은 연락처 편집 화면을 한 번에 표시하는 작업이 있는데, 나는 그에게 다음과 같은 방법을 보여줍니다.CNContactViewController setEditing before to appear
@objc private func presentContactEditController() {
guard var contact = contactModel.contact else { return }
if !contact.areKeysAvailable([CNContactViewController.descriptorForRequiredKeys()]) {
do {
let contactStore = CNContactStore()
contact = try contactStore.unifiedContact(withIdentifier: contact.identifier, keysToFetch: [CNContactViewController.descriptorForRequiredKeys()])
} catch {
debugPrint("presentContactEditController error", error.localizedDescription)
}
}
let cnContactViewController = CNContactViewController(for: contact)
cnContactViewController.delegate = self
cnContactViewController.setEditing(true, animated: false)
let contactNaviController = UINavigationController(rootViewController: cnContactViewController)
present(contactNaviController, animated: true, completion: nil)
}
하지만이 연락처에 대한 정보가있는 화면이 있습니다. 그래서 CNContactViewController, 다른 방법 ViewController
라이프 사이클의 상속을 통해 그것을하려하지만, 그것은 viewDidAppear
메서드에서만 작동하지만 사용자에게 표시됩니다. 이 문제를 어떻게 해결할 수 있습니까? 고맙습니다.