首页 > 解决方案 > CNContactViewController 弹出前出现意外图标

问题描述

我正在尝试使用 Swift 为 NewContact 创建一个 CNContactView。单击按钮后,应该会弹出一个 CNContactViewController,但在视图弹出之前会出现一些奇怪的徽标。如何解决这个问题?

我正在使用 Swift 4.1,但在我的旧项目 Swift 3.3 上也遇到了同样的问题。Xcode 版本是 9.4.1。

这是视频演示:Bug的视频演示

这是项目:项目

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.

不需要的图标

标签: iosswiftcncontactviewcontroller

解决方案


推荐阅读