No such luck in WWDC2021...
I'm starting to see my namespace get out of control in the containers from scratch apps I'm building to figure out CK sharing...
Especially in the Development zone, this is really needed!
Post
Replies
Boosts
Views
Activity
The video from WWDC2021 covers it at a high level, and from there it feels like we're expected to derive everything from the documentation, which is pretty sparse... A basic "Hello World" application implementing shared data and showing how the application needs to manage the multiple databases would be very helpful indeed.
I was about to start writing such an app, before I discovered a few bugs in the basic CK implementation for the Xcode 13 beta.
Im having exactly the same problem. So far no resolution. Definitely seems to be the beta, as I've build the "CoreData + CloudKit" boilerplate app in Xcode 12.x which works, and then built the same with Xcode 13 which breaks.
Did you also notice that when you go back to Xcode 12.x, the old "minimise to refresh" trick doesn't work anymore? You have to close the app and restart it for the iCloud data to get pulled.
I've had a similar problem trying to get the "boiler plate" app code that is generated by Xcode for a new project to run correctly. The App (which worked in Xcode12.x) not tries to connect to iCloud and appears to have authentication problems... it generates "failed to sync users" messages when it tried to connect on a simulator that has a valid user signed in.
Steps to repeat:
Start a new project in Xcode 12.x with CloudKit and CoreData enabled
Enable the remote notifications and iCloud capabilities, selecting CloudKit and creating a new container
Make a couple of changes to the ContentView to fix the error in the generated code (needs to include a PaginationView and wrap the toolbar elements in ToolbarItem Views)
Run on two signed-in simulators and observe the synchronisation working (noting that perhaps now you need to close the app and restart it for the sync to work, instead of the old minimise refresh trick)
Close Xcode 12.x and start the Xcode 13 Beta
Load and build the previous project on two simulators
Note now that the app no longer appears to talk to iCloud properly`
I'd be wrapped if someone could tell me I've stuffed up, but it feels like a problem with the Beta environment.
Andy
Have you checked the debug output from the simulator? Could you post a snippet from that?
I'm getting a similar issue, with a whole lot go "failed to sync users" error messages in the debug output. That's just using the boilerplate sample application, which worked in the previous version of Xcode and sim... but so far no-one has provided any insight into why this might be happening.
OK. One of the problems was that the body method of the ContentView isn't correct out of the box... once resolved it performs correctly in Xcode 12 under the accompanying simulator.
However in the current Xcode 13 Beta it fails to operate as expected with CloudKit (I've reported this via Feedback), resulting in the identify issues as above ("Failed to modify some record zones", "Failed to set up CloudKit integration for store", "Failed to modify some record zones", "Failed to sync user keys" are the errors being reported)
I believe the ContentView.swift body method should read as follows:
NavigationView {
List {
ForEach(items) { item in
Text("Item at \(item.timestamp!, formatter: itemFormatter)")
}
.onDelete(perform: deleteItems)
}
.toolbar {
#if os(iOS)
ToolbarItem(placement: .bottomBar){
EditButton()
}
#endif
ToolbarItem (placement: .primaryAction) {
Button(action: addItem) {
Label("Add an Item", systemImage: "plus")
}
}
}
}