Shailesh
Shailesh

Reputation: 3118

iOS Realtime Firebase Remote Config listener addOnConfigUpdateListener not returning the callback

I have been trying to implement the Firebase realtime remote config API. I already had the Firebase implementation added in the project.

Recently have been trying to implement addOnConfigUpdateListener to receive the realtime update whenever a value is changed or updated on the Firebase console.

However, Firebase does not return the callback for addOnConfigUpdateListener

I have tried to follow their documentation wherein they clearly mention that this listener should be added after fetching the values and then activate them.

Here is the code example -

func fetchRemoteValues() -> Bool {
        remoteConfig.fetch {[weak self] _, responseError in
            guard let self = self else {
                return false
            }
            if let error = responseError {
                return false
            } else {
                self.remoteConfig.addOnConfigUpdateListener {[weak self] _, updateError in
                    guard let self = self else {
                        return false
                    }
                    if let error = updateError {
                        return false
                    } else {
                        self.remoteConfig.activate { changed, activationError in
                            if let error = activationError {
                                return false
                            } else {
                                return changed
                            }
                        }
                    }
                }
            }
        }
    }

What am I doing wrong? or is this a bug in the Firebase itself.

Firebase version is 10.23.1

Xcode 15.2

iOS 17.4

Upvotes: 0

Views: 152

Answers (0)

Related Questions