This is code to encode [CNContact] array to NSData and upload to iCloud There are problem is a limit to upload information to iCloud( Text of error here
Error: Optional(<CKError 0x2809b81e0: "Limit Exceeded" (27/2023); server message = "record too large"; op = 0593B55F3FDA20ED; uuid = 7E2C10A5-CC4E-4278-8129-72BCC04D9B2C; container ID = "iCloud.com.own.team.ContactToCloud">)
How can I upload/save this type of info to iCloud???
func addItem( name: String) {
allContact = getContact()
print("allContact \(allContact)")
do {
let encodedData : NSData = try! NSKeyedArchiver.archivedData(withRootObject: allContact, requiringSecureCoding: true) as NSData
let newContactBook = CKRecord(recordType: "ContactBook")
newContactBook["data"] = encodedData
newContactBook["name"] = name
saveToCloud(record: newContactBook)
} catch {
print("error during encoding data\(error)")
}
}