0

How is it possible to get all keys from the CNContact object rather that requesting a few in the fetch variable. Lets suppose you do not know what the keys / fields ahead of time & need to select them in order to know which ones to fetch?

e.g.: What I prefer not to do. Here I took  a guess as to what fields might be in the Contact.

I’d rather have a view of the Keys before I decide what to select

 

let toFetch = [CNContactGivenNameKey, CNContactFamilyNameKey]

do{
        let contacts = try store.unifiedContactsMatchingPredicate(
          predicate, keysToFetch: toFetch)

        for contact in contacts{
          print(contact.givenName)
          print(contact.familyName)
          print(contact.identifier)
        }

} 
catch let err
{
     print(err)
}
iOS-Blog Admin Team answered