未能接收nsubiquitouskeyvaluestoreinitialsyncchange
我有一个用Objective-C编写的iPhone/iPad应用程序。
我的应用使用键值存储数据模型通过iCloud在多个设备之间共享数据。这种逻辑已经开始工作了几年。
昨天,我从iPhone A中清除了我的应用程序,然后将该应用重新安装到iPhone A上,然后在iPhone A上启用了iCloud共享A。
在启用了iCloud数据之后,根据预期的是,我最新数据的完整副本从该iPhone A下载到iPhone A上。 iCloud。一切看起来都不错。
但是后来,当我修改iPhone A上的数据并尝试通过iCloud与其他设备共享数据时,我收到了一条错误消息。
错误消息警告我,除非我从iCloud收到了初始共同汇合通知之前,我不明智地通过iCloud和其他设备在iPhone A上传播数据是不明智的。
很久以前,当我编写了此iCloud代码时,我已经将其设置了,以便它拒绝将数据发送到iCloud,除非它先前已经设置了一个标志,以表明它已经看到了传入的初始Syncchange通知。
但是,在这里感到困惑的是,在启用了iCloud共享后,我从iCloud上看到了我最近在iPhone A下载的共享数据的副本。
当我调查此情况并多次重复情况时,我发现当我共享的iCloud数据的初始副本到达iPhone A上时,它们会带有StoreServerChange通知,而不是初始共同汇总通知。
我不知道为什么会改变。还有其他人看到类似的东西吗?
对于这个问题,我有一个明显且容易解决的问题,但是实际上,当我不完全理解事情发生变化时,我真的很讨厌应用修复程序。
如果您很好奇,我的修复程序将是更改我设置记录的标志的方式,如果我看到了传入的初始共同汇合通知。
现在,当我看到初始共同汇总通知或StoreServerChange通知时,我将设置它。
要么通知“证明”我有一个有效的共享数据副本。如果未设置标志,则现有逻辑可以防止应用程序发送伪造数据并与有效的共享数据混乱。
任何想法或故障示意建议将不胜感激。
I have a iPhone/iPad App written in Objective-C.
My App shares data between multiple devices via the iCloud using the Key-Value Storage data model. This logic has all worked now for literally years.
Yesterday, I cleared my App from my iPhone A, I reinstalled the App onto iPhone A and then I enabled iCloud Sharing on iPhone A.
After enabling iCloud data, as expected, a full copy of my most recent data downloaded onto iPhone A from the iCloud. Everything looked good.
But later, when I modified the data on iPhone A and attempted to share it with the other devices via iCloud, I got an error message.
The error message warned me that until I had received an InitialSyncChange notification from iCloud, it was unwise for me to propagate the data on iPhone A through the iCloud and onto my other devices.
Long ago, when I wrote this iCloud code, I had set it up so that it would refuse to send data out to the iCloud unless it had previously set a flag indicating that it had seen an incoming InitialSyncChange notification.
But what puzzled me here was that I had seen a copy of my most recent shared data downloaded onto iPhone A from the iCloud after I had enabled iCloud sharing.
When I looked into this and repeated the situation several times, I discovered that when the initial copies of my shared iCloud data were arriving on iPhone A, they were arriving with StoreServerChange notifications and not with InitialSyncChange notifications.
I have no idea why this has changed. Has anyone else seen something similar?
I have an obvious and easy fix for the problem but, in truth, I really hate applying fixes when I don't fully understand why things have changed.
My fix, if you are curious, would be to change how I set the flag that records if I've seen an incoming InitialSyncChange notification.
Now I will set it when I've seen either a InitialSyncChange notification or StoreServerChange notification.
Either notification 'proves' that I've got a valid copy of the shared data. And if as the flag is not set, then the existing logic prevents the App from sending out bogus data and messing with the valid shared data.
Any thoughts or trouble-shooting advice would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论