Skip to content

Using FirebaseApp.delete() results in unusable Messaging singleton #3411

Closed
@cooksimo

Description

Describe your environment

  • Xcode version: 10.2.1
  • Firebase SDK version: 6.5.0
  • Firebase Component: Messaging
  • Component version: 4.1.1

Describe the problem

We have several projects set up, representing different environments for remote config. We use Messaging to enable real time remote config updates. When a user switches the firebase environment within the app, we delete the default app, and attempt to recreate it.

FirebaseApp.delete({ _ in })
FirebaseApp.configure(options: options)

Once this has been done any interaction with Messaging will not work. We have encountered this because we were running a very old version of Firebase (4.13.0) & Messaging (2.2.0) and we're trying to update to the latest. This approach worked in those versions.

This problem looks to be in the implementation of messaging(), there is a dispatch_once block to actually set everything up, this doesn't make sense if the singleton object can actually be deallocated and recreated.

I have attempted to solve this by calling start manually, and this seems to fix some things, but the new Messaging instance never gets notified of the fcmToken being available so cannot subscribe to anything.

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions