如何保持快速更新云工具包记录? [英] How to keep updating cloud kit record in swift?

查看:58
本文介绍了如何保持快速更新云工具包记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序需要将用户当前位置更新到云服务器 那么如何将用户当前位置更新到云服务器? 我尝试使用saveRecord,但是它不起作用 和发生错误

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">)

谢谢:)

推荐答案

您首先必须获取记录,然后将其更改并保存回去.如果您遇到相同的错误,那么记录将被其他人更改.您可以从错误中获取更改的记录,也可以再次获取它.然后再次应用更改并将其保存到CloudKit

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

这篇关于如何保持快速更新云工具包记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆