【发布时间】:2014-04-19 21:46:44
【问题描述】:
当我将用户数据(如果用户请求)同步到 iCloud(使用NSUbiquitousKeyValueStore)时,
它正确同步。但是,当我使用 2 个不同的设备和 2 个不同的 Apple ID 时,我在两者上都看到了相同的数据,并且我仍然能够在它们之间进行同步。所以多个用户可以看到彼此的数据。
有什么方法可以使同步用户具体化,还是我在某处犯了错误?
我使用的一些代码:
NSUbiquitousKeyValueStore *icloudatas = [NSUbiquitousKeyValueStore defaultStore];
//save to iCloud
[icloudatas setString:[NSString stringWithFormat:@"%i",
[defaults integerForKey:@"lvl"]] forKey:@"lvl"];
//load from iCloud
[defaults setInteger:[[icloudatas stringForKey:@"lvl"] integerValue] forKey:@"lvl"];
[defaults syncronise];
[icloudatas synchronize];
问题已解决:
我刚刚在 App Store 中更改了我的 Apple ID,我忘记在 iCloud 中更改。 这解决了我的问题,一切正常。
【问题讨论】:
标签: objective-c sync icloud nsubiquitouskeyvaluestore