CNContactViewController highlightPropertyWithKey produces blank VC

Has anyone tried to display a contact with the CNContactViewController making one of the email addresses highlighted? I tried it, but if I use the highlightPropertyWithKey method, the resulting controller is blank and the following message is logged:


[CNUI ERROR] error calling service - Couldn’t communicate with a helper application.


I also tried using the deprecated API (ABPersonViewController), and the result is exactly the same. It works fine on iOS8 though.


Here's a sample code:


    func openAppleSeed(highlight:Bool) {
     
        let store = CNContactStore()
     
        let request = CNContactFetchRequest(keysToFetch: [CNContactEmailAddressesKey]);
     
        do {
            try store.enumerateContactsWithFetchRequest(request, usingBlock: {
             
                (contact:CNContact, stop:UnsafeMutablePointer<ObjCBool>) -> Void in
             
                for address in contact.emailAddresses
                {
                    if address.value as! String == "John-Appleseed@mac.com" {
                     
                        do {
                            let fullContact = try store.unifiedContactWithIdentifier(contact.identifier, keysToFetch: [CNContactViewController.descriptorForRequiredKeys()])
                         
                            let vc = CNContactViewController(forContact: fullContact)
                         
                            vc.contactStore = store
                         
                            if highlight {
                                vc.highlightPropertyWithKey(CNContactEmailAddressesKey, identifier: address.identifier)
                            }
                         
                            self.navigationController?.pushViewController(vc, animated: true)

                            return
                        }
                        catch {
                            print("CATCHING (B)")
                        }
                     
                        return;
                    }
                }
             
            })
        }
        catch {
            print("CATCHING (A)")
        }
    }


Calling this function openAppleseed(highlight:false) works fine, but openAppleseed(highlight:true) generates the blank view controller and the log message mentioned aboved.


I tested it with the latest beta (5), and both simulator and device. Same result. I am submitting a bug report now, but I was curious if anyone had the same issue. Any workarounds?


Cheers.

Replies

Bug report submitted: #22298420

This also affects ABPersonViewController.

I submitted rdar://22604487 (ABPersonViewController shows a blank page). If you want to dupe, it's also on Open Radar (not linked to avoid moderation).

I have the same problem that the property doesn't get highlighted, except the error message is:

"[PPT] Error creating the CFMessagePort needed to communicate with PPT."

Is there a current solution or workaround?

Hi @kontiki, have you figured out how to get the highlightProperty of CNContactViewController to work?