Firebase 中的错误 iOS Codelab 聊天应用教程

Error in Firebase iOS Codelab Chat App tutorial

在 Swift 中为 iOS 构建 Firebase 教程应用程序时,我卡在了第 8 页的说明中,我们设置该应用程序以允许用户发送图像消息。教程中显示的代码可能有错误,或者我的框架没有正确连接,但我已经更新了 pod 并清理并重新构建了应用程序,但两次仍然出现此错误 Constants.MessageFields.imageUrl 已列出。

代码:

if let imageUrl = message[Constants.MessageFields.imageUrl] {

错误:

"Type 'Constants.MessageFields' has no member 'imageUrl'"

This is a fatal error and build always fails on this line.

Link到教程中的这个页面here

它在 Constants.swift 文件中丢失。只需将以下代码添加到 MessageFields 结构中:

static let imageUrl = "imageUrl"