Skip to content

Make Firebase components initializable without access to disk resources (Keychain) #10494

Open
@morganchen12

Description

@morganchen12

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:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions