我正在尝试使用Swift创建一个CNContactView forNewContact。单击按钮后,应弹出CNContactViewController,但是在弹出视图之前会出现一些奇怪的徽标。如何解决这个问题?
我正在使用Swift 4.1,但是我的旧项目Swift 3.3中存在相同的问题。 Xcode版本是9.4.1。
这是视频演示:Video demo for Bug
这是项目: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.