问题
My app needs to update users current location to cloud server So how to update users current location to cloud server? I tried to use saveRecord but it doesn't work and error occurred
error:Optional(<CKError 0x17005eea0: "Server Record Changed" (14/2037); "Error saving record <CKRecordID: 0x1458bb9c0; FASVSE10761FDM:(_defaultZone:__defaultOwner__)> to server: Protection data didn't match">)
Thanks :)
回答1:
You first have to fetch the record, then change it and save it back. If you get the same error, then the record is changed by someone else. You can get the changed record from the error or you could just fetch it again. Then again apply the changes and save it to CloudKit
来源:https://stackoverflow.com/questions/36907061/how-to-keep-updating-cloud-kit-record-in-swift