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")
}
}
}
}
Post
Replies
Boosts
Views
Activity
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.
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
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.
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.
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!
OK. More experimenting and the plot thickens.
To check whether this was a simulator or Xcode issue, I deployed the modified base application to a local iPad and iPhone. Interestingly the user sync errors now go away, maying me believe there is something wrong with the sign-in capability on the Beta simulator...
However no record changes were observable in the CloudKit Dashboard. I tried signing out and in again without any change.
I then reset the dev environment in CloudKit, and restarted the apps on the devices.
At this stage, interestingly, they show some interesting behaviour.
The items previously created are gone - that makes sense, since I just blew away the development data
The Schema is not loaded, as expected for a refreshed Dev environment (i.e. the CD_Item record type doesn't exist)
When I add my first item in the app, the CD_Item record type appears in the schema
I then add an index on RecordID, and query the database, which yields no records.
So the app is definitely communicating successfully with CloudKit now, as it's building the schema, but the data is not appearing in the database.
And it gets more interesting again.
When I add an item on the iPhone, the iPad debug window seems to indicate it is getting push notifications from the database update, but those changes don't appear in the iPad interface...
And lastly, if I then try to delete an Item on the iPad, I get an error message that a merge conflict could not be resolved.
Has something become pretty seriously unravelled in this latest release?
G'day Stokaace,
Nope - still waiting for anyone from engineering to see these apparently. I might try to hit up Nick directly. Seems like a pretty fundamental issue if the basic boilerplate app won't run successfully...
I've had a look at the demo code Nick put up, but it's "Old School" UI, rather than SwiftUI, which is a bit frustrating given the high recommendations to move development towards this "new" framework.
I'm still having these problems on Beta 2. Anyone else?
Has anyone been able to get this to work in Beta 2? Still looks broken to me...
Interestingly still no fix in Beta 2, and not a lot of conversation. Am I the only one encountering this (I know that I'm not, but it does seem very quiet)
Thanks Rob, just poked your question too... seems funny that we're not seeing any feedback on this - surely someone has run the code before releasing it :)
There is : https://developer.apple.com/documentation/coredata/synchronizing_a_local_store_to_the_cloud
This has been resolved in Xcode 13 Beta 4.
Beta 3 seems to have resolved most of the issues, with Beta 4 fixing the problems with provisioning profiles... back to trying to get sharing to work...
If anyone has seen cktool in action please let me know - I can't find it anywhere in the beta installations :)