I am trying to create a CNContactView forNewContact using Swift. After I click the button, a CNContactViewController should pop up, but some weird logos appears before the view pops. How to fix this?
I am using Swift 4.1, but I have the same issue on my old project Swift 3.3. Xcode version is 9.4.1.
Here is the video demo: Video demo for Bug
Here is the project: project
import UIKit
import Contacts
import ContactsUI
class ViewController: UIViewController,CNContactViewControllerDelegate {
override func viewDidLoad() {
super.viewDidLoad()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
func contactViewController(_ vc: CNContactViewController, didCompleteWith con: CNContact?) {
vc.dismiss(animated: true)
}
@IBAction func addContact(_ sender: Any) {
let con = CNMutableContact()
con.givenName = "test"
let unkvc = CNContactViewController(forNewContact: con)
unkvc.delegate = self as CNContactViewControllerDelegate
self.present(UINavigationController(rootViewController: unkvc), animated:true)
self.view.endEditing(true)
}
}
2018-06-19 15:52:13.911766-0700 contactbook[5319:1973728] Access to PassKit Shared Cache file denied. Please verify sandbox exceptions and/or file a Radar.
2018-06-19 15:52:14.087053-0700 contactbook[5319:1973728] [App] if we're in the real pre-commit handler we can't actually add any new fences due to CA restriction
2018-06-19 15:52:14.269548-0700 contactbook[5319:1973728] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2018-06-19 15:52:14.270754-0700 contactbook[5319:1973728] [MC] Reading from public effective user settings.
2018-06-19 15:52:14.342483-0700 contactbook[5319:1973728] [Snapshotting] Snapshotting a view (0x10334a5a0, _UIButtonBarStackView) that has not been rendered at least once requires afterScreenUpdates:YES.
2018-06-19 15:52:14.342971-0700 contactbook[5319:1973728] [Snapshotting] Snapshotting a view (0x10334ab00, _UIButtonBarStackView) that has not been rendered at least once requires afterScreenUpdates:YES.