It seems for whatever reason inverse relationship needs to be explicitly defined. Change from this:
@Relationship(deleteRule: .cascade) var tasks: [MyTask]? = []
to
@Relationship(deleteRule: .cascade, inverse: \MyTask.todo) var tasks: [MyTask]? = []
has solved the crash issue. Works both in iOS 17.3 and 17.4.
Post
Replies
Boosts
Views
Activity
I have now identified that this issue is happening due to Relationships in my model. My MyToDo has task defined like this:
@Relationship(deleteRule: .cascade) var tasks: [MyTask]? = []
and MyTask has reference back as following:
var todo: MyTodo?
Both of them are optional as required for CloudKit. This model can be read in iOS 17.3, but in 17.4 beta, it crashes!
Widget can obtain the data without error/crash from modelContainer using this code:
guard let modelContainer = try? ModelContainer(for: MyTodo.self) else {
return []
}
My model do not have any @Attribute(.unique)
All properties have default values
Relationships are marked as optional
App is using CloudKit for iCloud syncronization
A brandnew app with the same model does not have this issue.
When I uncheck "CloutKit" in Signing & Capabilities, the app launch normally.
I dont have an answer and don't know how to generate 5.5" screenshots. However, Apple clarified that those are needed :(
https://developer.apple.com/forums/thread/719822
Same problem with me as well. Neither alignment, nor .timer works.