Post

Replies

Boosts

Views

Activity

Reply to Xcode cloud and unlinking SCM
I'm currently dealing with the exact same thing. Using Github as my SCM, I was getting errors telling me I had to reconnect, but clicking reconnect only gave me another error saying it was incomplete. Thought maybe I'd just start over from scratch and deleted all Xcode Cloud data. Now it gets stuck at "Grant Access to Your Repository" and I get a popup error telling me my app couldn't be added to Xcode Cloud. Added my own feedback. FB number is FB9785098.
Nov ’21
Reply to SwiftData with CloudKit failing to migrate schema
I figured out the solution, in case anyone else stumbles on this and is looking for an answer. It seems that the solution is to do: do { if let container = try? ModelContainer( for: Foo.self, Bar.self, migrationPlan: SchemaMigration.self, configurations: ModelConfiguration(cloudKitDatabase: .automatic) ) { self.container = container } else { self.container = try ModelContainer( for: Foo.self, Bar.self, migrationPlan: SchemaMigration.self, configurations: ModelConfiguration(cloudKitDatabase: .none) } } catch { // handle error } Essentially, if it fails the first time, disable CloudKit. This lets the SchemaMigration perform and complete and will load the container. Of course, CloudKit is disabled still, but the next time the app launches, the schema will be compatible and CloudKit will load up fine.
Jan ’24
Reply to Disable automatic iCloud sync with SwiftData
Is this an issue again? I previously ran into issues with migrating my schema to be CloudKit compatible and posted about it 2 months ago here: https://forums.developer.apple.com/forums/thread/744491. My solution I found was to disable CloudKit via the ModelConfiguration with CloudKitDatabase.none if it initially failed to load the ModelContainer. It allowed my data to go through the migration process first before attempting to sync with CloudKit. Everything was working fine, until just this week. I had a couple more crash reports show up. I reproduced it locally and sure enough, even with the CloudKitDatabase set to .none, it's crashing with an error CloudKit integration requires that all attributes be optional, or have a default value set.. It's not even throwing an error for me to catch, it's just crashing with Fatal error: 'try!' expression unexpectedly raised an error: SwiftData.SwiftDataError(_error: SwiftData.SwiftDataError._Error.loadIssueModelContainer) (my code doesn't use try! or any fatalError(), I only catch the error and attempt to gracefully fail with a user facing error message). It seems like iOS 17.4 might have broke this again? Can anyone else confirm?
Mar ’24
Reply to SwiftData with CloudKit failing to migrate schema
If your migration plan includes a custom migration, this solution no longer works in iOS 17.4 and will crash (not in the catch, but in the ModelContainer init). I submitted feedback on this issue: FB13694972. It's easily reproducible. The first attempt to initialize the ModelContainer will fail normally and throw an error, as expected. The second one just crashes and complains about the model not being compatible with CloudKit, even though it's set to .none. Before iOS 17.4 works fine.
Mar ’24