ios - 未收到远程配置回调 - 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
}
推荐阅读
- sql - 如何交叉检查有 2 个重复条目的 2 个表
- java - 如何使用 PDFBox 2 密集合并 PDF 文件,而分页符附近没有空格?
- angular - 如何使用 Angular 或 Django 制作可打印的报告(几个图表)
- ios - 如何在没有中间目录的画廊中编写视频?
- android - 将数据片段传递给活动时出错
- checksum - 什么是最“位高效”的错误检测方法?
- javascript - 使用复选框过滤带有 JSON 的元素
- javascript - 网页上多行文本的省略号 + 引号
- c# - C# - Signalr 客户端连接导致性能问题 Windows 服务
- python - 解析 Pandas 作为列表返回