iCloud Sync确实可以在iPhone&Mac,但不适用于iPad [英] iCloud Sync does work on iPhone & Mac but not on iPad

查看:141
本文介绍了iCloud Sync确实可以在iPhone&Mac,但不适用于iPad的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现iCloud Sync有一个奇怪的问题.

I have found a strange problem with iCloud Sync.

情况:我已经开发了iOS,iPadOS和使用SwiftUI的macOS App.这三个版本共享相同的代码库(macOS版本是Catalyst iPad版本).该项目确实通过 NSPersistenceCloudKitContainer 支持iCloud Sync,以在所有3个设备之间同步数据.

Situation: I have developed an iOS, iPadOS & macOS App using SwiftUI. All three Versions share the same Codebase (macOS Version is a Catalyst iPad Version). The Project does support iCloud Sync via the NSPersistenceCloudKitContainer to sync data between all 3 devices.

问题:iCloud Sync在iPhone和Mac之间完美运行,但是当将其与iPad一起使用时,我会遇到一个非常奇怪的问题.在iPad上创建新的CoreData对象时,它会在几秒钟后出现在我的其他设备上,这完全可以.但是,在iPhone或Mac上创建CoreData对象时,它不会出现在iPad (我等待了10分钟)上.仅当关闭并重​​新打开该应用程序时,该对象才会出现.

Problem: iCloud Sync works perfectly between my iPhone and my Mac, but when using it with my iPad, I face a really strange problem. When creating a new CoreData Object on my iPad, it will appear on my other devices after a few Seconds, which is totally fine. However, when creating the CoreData Object on my iPhone or Mac, it will not appear on the iPad (I waited 10min). Only when closing and reopening the App, the Object will appear.

详细信息:我什至不必完全退出该应用程序.只需向上滑动至应用程序选择器"并再次选择该应用程序即可.

Details: I not even have to fully exit the App. It is enough to just swipe up to Application Picker and select the App again.

问题:是否有人有想法或可能导致此奇怪错误的东西?请记住:这三个设备都使用相同的代码库.

Question: Does anyone has an idea or something what could cause this strange error? And remember: All three devices are using the same codebase.

推荐答案

请确保您已根据 使用

Sync CoreData with CloudKit using

try? persistentContainer.viewContext.setQueryGenerationFrom(.current)

这篇关于iCloud Sync确实可以在iPhone&Mac,但不适用于iPad的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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