Skip to content

Accessing Firestore after terminate() crashes the app #15463

@natep

Description

@natep

Description

In Swift, if you call Firestore.terminate() and then something manages to access Firestore after that, it crashes the app with the following message:

*** Terminating app due to uncaught exception 'FIRIllegalStateException', reason: 'The client has already been terminated.'
terminating due to uncaught exception of type NSException

The docs say:

After calling terminate only the clearPersistence method may be used. Any other method will throw an error.

But it isn't throwing an error - it's throwing an Obj-C exception, which cannot be handled in Swift.

This should really just throw an error instead of crashing the app.

Reproducing the issue

In Swift, call Firestore.terminate() and then call any other method on the Firestore instance.

Firebase SDK Version

12.5.0

Xcode Version

26.0.1

Installation Method

Swift Package Manager

Firebase Product(s)

Firestore

Targeted Platforms

All

Relevant Log Output

If using Swift Package Manager, the project's Package.resolved

Expand Package.resolved snippet
Replace this line with the contents of your Package.resolved.

If using CocoaPods, the project's Podfile.lock

Expand Podfile.lock snippet
Replace this line with the contents of your Podfile.lock!

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions