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

时间:2022-09-10 19:17:48

While building the Firebase tutorial app for iOS in Swift, I got stuck at page 8 in the instructions where we set up the app to allow users to Send Image Messages. It is likely either an error with the code shown in the tutorial, or with my frameworks not being connected properly, but I have updated the pod and cleaned and re-built the app, and still am getting this error for both times Constants.MessageFields.imageUrl are listed.

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

Code:

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

Error:

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

“类型'Constants.MessageFields'没有成员'imageUrl'”

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

这是一个致命错误,并且此行的构建始终失败。

Link to this page in the tutorial here

在此处的教程中链接到此页面

1 个解决方案

#1


1  

It's missing in the Constants.swift file. Just add the following code to the MessageFields struct:

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

static let imageUrl = "imageUrl"

#1


1  

It's missing in the Constants.swift file. Just add the following code to the MessageFields struct:

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

static let imageUrl = "imageUrl"