CNContact add new contact issue

2019-06-02 15:41发布

问题:

I'm faccing an issue at time of adding contacts throught Contact Framework.

I used device iPhone 5s with iOS 12.1.2

My Code for adding contact is as below ::

let saveRequest = CNSaveRequest()
saveRequest.add(self, toContainerWithIdentifier: nil)
do {
    try contactStore.execute(saveRequest)
} catch let error {
    print("Error occurred while saving the request \(error)")
}

This everytime thows error as below ::

Error occurred while saving the request Error Domain=CNErrorDomain Code=1 "Communication Error" UserInfo={NSLocalizedDescription=Communication Error, NSLocalizedFailureReason=An error occurred while trying to communicate with the Contacts service.}

Dose any one now anything about this error?

I'm not able to found any thing about this.