Description
Currently, Firebase requires access to the keychain on startup to do a couple things, including:
- Check for the existence of a logged in user
- Check for the existence of a previous installation token
With app pre-warming, the app may be launched without user interaction up to the UIApplicationMain
function. This documentation doesn't mention anything about SwiftUI, but the reports we've been receiving (#10200) suggest SwiftUI classes may be initialized during pre-warming. Our documentation has been updated to tell users to initialize Firebase in a UIApplicationDelegate
implementation instead, but since SwiftUI doesn't guarantee when views will be instantiated wrt keychain availability, this method works only coincidentally and has the unpleasant side effect of requiring people who use SwiftUI to lazily reference Firebase everywhere or their Firebase references may be invoked by SwiftUI initializing a view while data protection is still on.
Ultimately Firebase needs to work without assuming all resources are available on initialization.
Related reading: