Peter Leondires
Peter Leondires

Reputation: 59

How do I disable persistence (caching) for firestore on iOS

I am trying to set isPersistenceEnabled = NO for firestore in the GoogleService-Info.plist file I imported into my react-native file.

I tried setting to IS_PERSISTENCE_ENABLED = NO, however I can still see that firestore is pulling from the local cache. What is the proper way to disable this setting?

Upvotes: 1

Views: 5371

Answers (1)

Doug Stevenson
Doug Stevenson

Reputation: 317372

This is described in the documentation:

let settings = FirestoreSettings()
settings.isPersistenceEnabled = false

// Any additional options
// ...

let db = Firestore.firestore()
db.settings = settings

There's no option in the configuration plist for this. You have to configure persistence with code.

Upvotes: 3

Related Questions