Post

Replies

Boosts

Views

Activity

Reply to EnvironmentObject Causes SwiftUI App to Crash When Launched in the Background
I'm finding this exact situation, in an app being background-launched in response to CloudKit attempting to update my SwiftData-based storage after the watchOS variant synchronizes a new record upstream, and the iOS app attempts to persist that record. I will look at the environment object usage in my ContentView. To my knowledge, there is no way to avoid instantiating a ContentView in a SwiftUI app, right? For instance, handling background functionality without any UI. Another developer is finding something similar. https://stackoverflow.com/questions/78265564/background-crash-swiftdata-swiftui-one-time-initialization-function-for-empty
Apr ’24