未接收到远程配置回调-iOS



伙计们,我对此感到厌倦,我在演示项目中尝试过这些东西,它运行正常,可以获取远程配置值。

但在我的项目中,当我集成远程配置设置时,我没有得到fetch方法的回调。

这是我所做的代码。

override func viewDidLoad() {
remoteConfig = RemoteConfig.remoteConfig()
let settings = RemoteConfigSettings()
settings.minimumFetchInterval = 0
remoteConfig.configSettings = settings
remoteConfig.setDefaults(fromPlist: "RemoteConfigDefaults")
self.getRemoteConfig()
}
func getRemoteConfig() {
print(remoteConfig["colorPrimaryDark"].stringValue ?? "NOT FOUND")
remoteConfig.fetch(withExpirationDuration: TimeInterval(10)) { (status, error) in
if status == .success {
print("Config fetched!")
self.remoteConfig.activate(completionHandler: { (error) in
// ...
})
}
else {
print("Config not fetched")
print("Error: (error?.localizedDescription ?? "No error available.")")
}
self.PrintConfigValues()
}
}
func PrintConfigValues() {
print("REMOTE VALUES : ----- (remoteConfig["colorPrimaryDark"].stringValue ?? "NOT FOUND")")
}

为什么我没有得到fetch方法的回调呢。请帮帮我。

我希望您已经在Appdelegate文件中实现了这一行:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
FIRApp.configure()
return true
}

相关内容

最新更新