Swift MessageKit - 参数标签“(type:)”不匹配任何可用的重载

Swift MessageKit - Argument labels '(type:)' do not match any available overloads

我已经开始尝试使用 Firebase Chat 教程中的 MessageKit,该教程目前使用 MessageKit。我遇到了教程项目中没有出现的这个错误。当我尝试使用教程项目中的代码时出现此错误,并且不确定如何解决它。

参数标签“(type:)”不匹配任何可用的重载

let cameraItem = UIBarButtonItem(type: .system)

您不能使用不同的初始化程序创建 UIBarButtonItem like that because it's not part of the documentation. Here is the official documentation of UIBarButtonItem

如果你想用默认系统项目创建 UIBarButtonItem:

UIBarButtonItem(barButtonSystemItem: .cancel, target: self, action: Selector("handleCancel")

这是所有 UIBarButtonItem.SystemItem 的列表,您可以使用它们来创建 UIBarButtonItem

您还可以使用不同的数据创建 UIBarButtonItem,例如图像、文本等...看看这个 page