0

I'm trying to retrieve some data from my remote config variables but I keep getting the value from my plist file. This is my code:

let apolloConfigKey = "dev_username"
var remoteConfig: FIRRemoteConfig!

func createDefaults(){
    remoteConfig = FIRRemoteConfig.remoteConfig()
    let remoteConfigSettings = FIRRemoteConfigSettings(developerModeEnabled: true)
    remoteConfig.configSettings = remoteConfigSettings!
    remoteConfig.setDefaultsFromPlistFileName("RemoteConfigDefaults")
    fetchConfig()
}
func fetchConfig(){

    print("Value fetched! \(remoteConfig[apolloConfigKey].stringValue)")

    var expirationDuration = 3600
    if remoteConfig.configSettings.isDeveloperModeEnabled {
        expirationDuration = 0
    }
    remoteConfig.fetch(withExpirationDuration: TimeInterval(expirationDuration)) { (status, error) -> Void in
        if status == .success {
            print("Config fetched!")
            self.remoteConfig.activateFetched()
        } else {
            print("Config not fetched")
            print("Error \(error!.localizedDescription)")
        }
        //self.displayWelcome()
    }

}
func getRemoteValue(){
    createDefaults()
}

The print always return the value from my plist.

GusDev
  • 215
  • 6
  • 18

1 Answers1

0

Rookie mistake: we have two projects in Firebase and I was trying to get the values from the wrong project, sorry.

GusDev
  • 215
  • 6
  • 18