swiftcontactscncontactviewcontroller

CNContactViewController iOS 13 Discard Message and Keyboard


on iOS 13 it seems I cannot use CNContactViewController. This is the code I'm using:

 func showCNContactViewController(inVC vc: UIViewController, cncontact: CNContact, contact: Contact? = nil) {
        self.contact = contact
        self.mode = .editing

        let store = CNContactStore()
        let contactVC = CNContactViewController(forNewContact: cncontact)
        contactVC.delegate = self
        contactVC.allowsActions = false
        contactVC.contactStore = store
        contactVC.shouldShowLinkedContacts = true

        contactVC.title = cncontact.givenName
        let contactNC = UINavigationController(rootViewController: contactVC)
        vc.present(contactNC, animated: true, completion: nil)
    }

Using this I'm getting a weird Discard Message and If the user taps on any field it will present the keyboard and the message is below the keyboard thus the user can't even dismiss this without using the Swipe gesture to go down. I've been searching everywhere and I did found workaround to the keyboard problem but I didn't found anyone reporting this issue with the discard message.

CNContactViewController


Solution

  • Your project is missing Localizable.strings file (it can be empty, but it should exist in the project).

    enter image description here

    Strings will become human readable again :)

    enter image description here