firebase-ios-sdk icon indicating copy to clipboard operation
firebase-ios-sdk copied to clipboard

Accessing Firestore after terminate() crashes the app

Open natep opened this issue 1 month ago • 1 comments

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!

natep avatar Nov 04 '25 19:11 natep