How to keep updating cloud kit record in swift?

三世轮回 提交于 2019-12-23 07:05:26

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!