我的项目中有大约 50 个相同的警告。自更新以来,我将 snapshot.value["something"] 称为我的所有函数!字符串
失败。他们都曾经工作过。我什至没有使用 RemoteConfig 功能。我只是想检索数据。
来 self 的用户类的示例:
init(snapshot: FIRDataSnapshot) {
firstName = snapshot.value!["firstName"] as! String
lastName = snapshot.value!["lastName"] as! String
}
一个函数的例子(我可以给出更多的例子,但它基本上是一样的):
func loadProfileImage(ref:FIRDatabaseReference) {
ref.observeEventType(.Value, withBlock: {snapshot in
let base64String = snapshot.value!["profileImgURL"] as! String
let decodedData = NSData(base64EncodedString: base64String, options:NSDataBase64DecodingOptions.IgnoreUnknownCharacters)
if let decodedImage = UIImage(data: decodedData!) {
self.profileImgImageView.contentMode = .ScaleAspectFill
self.profileImgImageView.layer.cornerRadius = self.profileImgImageView.frame.size.width / 2
self.profileImgImageView.clipsToBounds = true
self.profileImgImageView.image = decodedImage as UIImage
}
})
}
应用程序运行是因为它们只是警告,但警告是正确的,因为应用程序在尝试检索任何数据后立即失败。
最佳答案
显然,使用 Firebase/RemoteConfig pod 会导致此错误。一旦我卸载了 pod,警告就消失了。绝对把它作为一个错误。
关于ios - 从 'FIRRemoteConfigValue!' 转换为无关类型 'String' 总是失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37335486/