Ios 在多个应用程序之间共享公用键值存储不工作
我正准备发布我的一个应用程序的第二个版本。我将在以前版本的新捆绑包ID下发布这个新版本。在以前的版本中,我使用iCloud键值存储来保存一些设置和其他杂项信息。这是我的v1授权文件:Ios 在多个应用程序之间共享公用键值存储不工作,ios,objective-c,icloud,key-value,Ios,Objective C,Icloud,Key Value,我正准备发布我的一个应用程序的第二个版本。我将在以前版本的新捆绑包ID下发布这个新版本。在以前的版本中,我使用iCloud键值存储来保存一些设置和其他杂项信息。这是我的v1授权文件: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>get-task-allow</key>
<true/>
<key>com.apple.developer.ubiquity-kvstore-identifier</key>
<string>$(AppIdentifierPrefix)$(CFBundleIdentifier)</string>
<key>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)$(CFBundleIdentifier)</string>
</array>
</dict>
</plist>
NSUbiquitousKeyValueStore* store = [NSUbiquitousKeyValueStore defaultStore];
[store synchronize];
NSLog(@"%@", [store dictionaryRepresentation]);
{}
它应该打印类似于{“InstalledVersion1”=1;}
……但事实并非如此
我做错了什么?我是否需要耐心一点,商店才能同步
如果您感兴趣,请记录设备日志:(在调试器中运行
p(void)[[NSUbiquitousKeyValueStore defaultStore]\u printDebugDescription]
。答案有点荒谬,但对于任何面临类似问题的人来说都是如此
这就是我所做的
NSUbiquitousKeyValueStore* store = [NSUbiquitousKeyValueStore defaultStore];
[store setBool:YES forKey:@"InstalledVersion1"];
NSUbiquitousKeyValueStore* store = [NSUbiquitousKeyValueStore defaultStore];
[store synchronize];
NSLog(@"%@", [store dictionaryRepresentation]);