Hi, Developers. The project I am working on includes SwiftData for storing information. When inspecting, code-wise everything looks as it should, however, sometimes when interacting with data, the app crashes. The confusing part is that it happens sometimes. On one simulator, it might crash, while on another it might not. Should I reinstall the app it seems to be working fine again. Do you have and ideas. Any advice is appreciated. Take care!
I have experienced the same behavior and have added a button to regularly delete the data. I feel that during the development, when the data structure changes frequently, the application becomes buggy. Perhaps this might help you.
func removeStoredData() {
do {
try context.delete(model: WorkoutModelItem.self)
} catch {
fatalError(error.localizedDescription)
}
}
Before you start user testing, for example, in TestFlight, you can disable the button again.