How to convert CNContact to CNMutableContact?

2019-04-30 09:08发布

问题:

I need to get contact, change it, and store back.

CNContactStore().unifiedContacts gives me CNContact instance, but CNSaveRequest().update requires CNMutableContact.

How to convert CNContact to CNMutableContact?

回答1:

Just found a way:

let mutableContact = contact.mutableCopy() as! CNMutableContact