tvOS上的iCloud同步 [英] iCloud synchronization on tvOS
问题描述
到目前为止,是否有人能使iCloud在tvOS上运行?
has anybody managed to get iCloud working on tvOS so far?
我正在使用键值存储,它成功地将所有内容保存在iCloud中.但是,它不会在iOS-App和tvOS-App之间同步数据.我为两个应用程序使用了相同的包标识符.
I am using key-value-storage and it successfully saves everything in iCloud. However, it does not synchronize the data between the iOS-App and the tvOS-App. I am using the same bundle-identifier for both apps.
有人遇到过同样的问题吗?
Has anyone experienced the same issue?
推荐答案
因此,看来苹果在tvOS方面可能存在问题,因为如果我按照苹果关于配置通用键值存储的说明进行操作,多个应用程序 我可以使用完全相同的设置在iOS应用程序和macOS应用程序之间共享,但不能在tvOS应用程序之间共享.
So, it appears that Apple may have an issue here on the tvOS side, because if I follow Apple's instructions on Configuring Common Key-Value Storage for Multiple Apps I can share between and iOS App and a macOS App, but not the tvOS app using exactly the same setup.
以下是我的结果:
我使用1st的Apple指令:
Apple's Instuctions that I used 1st:
因此,CloudKit与默认的 Container 有关,而不是直接与App Bundle ID有关.因此,我使用默认容器设置了我的主要iOS应用,该容器将成为键值共享容器.
So, CloudKit is all about the default Container rather than the App bundle ID directly. So, I setup my Primary iOS app with default container that will become the key-value share container.
这是我的主要权利文件: 然后,我在默认存储中存储了两个NSUbiquitousKeyValueStore对,并检索了值:
Here is my Primary Entitlements file: I then stored two NSUbiquitousKeyValueStore pairs in the default store and retrieved the values:
NSUbiquitousKeyValueStore.defaultStore().dictionaryRepresentation
因此,在我的macOS应用程序中,我也启用了CloudKit,然后删除默认容器并将其设置为主要iOS应用程序"容器.然后,在权利文件中,我手动设置com.apple.developer.ubiquity-kvstore-identifier
以包括主应用程序的捆绑软件ID:
So, in my macOS app I enable CloudKit as well, and remove the default container and set it to the Primary iOS apps container. Then in the Entitlements file I manually setup the com.apple.developer.ubiquity-kvstore-identifier
to include the Primary App's bundle ID:
取消选中默认容器并切换主要":
Uncheck default container and toggle Primaries:
这是我的辅助macOS权利文件:
然后我运行macOS应用并进行预存储,我从主要默认键值存储中获得了键值对,并检索了easy-peasy值:
Then I run the macOS app and presto, I have the key-value pairs from the primaries default key-value store and retrieved the values easy-peasy:
NSUbiquitousKeyValueStore.defaultStore().dictionaryRepresentation
如果随后对我的tvOS应用进行了完全相同的修改,则defaultStore()显示为空,并且无法与iOS和macOS应用共享.
If I then make the SAME EXACT MODIFICATIONS to my tvOS app, the defaultStore() show as empty and I cannot get it to share with the iOS and macOS app.
这是我的辅助tsOS权利文件:
没有先见之明,没有值:
这篇关于tvOS上的iCloud同步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!