无法使用 Stream Chat iOS SDK 构建项目

Unable to build project with Stream Chat iOS SDK

我正在尝试使用新的 Stream iOS Chat SDK,但在通过 Cocoa pods 安装后无法构建它。在我们添加 StreamChat 之前,该项目正在与列出的其他 pods 一起构建。我正在使用 Xcode 10.2(不适用于 10.1)、Swift 4.2 和 Cocoapods 版本 1.7.4。我们使用了 Stream 网站上列出的 pod install 命令:

pod install --repo-update

我们的 Podfile 看起来像这样:

platform :ios, '11.0'
inhibit_all_warnings!

target 'Project-iOS' do
  use_frameworks!

  # Pods for Project-iOS
  pod 'ReachabilitySwift', '4.3.0'
  pod 'SwiftKeychainWrapper', '3.2.0'
  pod 'CropViewController'
  pod 'StreamChat'

  target 'Project-iOSTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'Project-iOSUITests' do
    inherit! :search_paths
    # Pods for testing
  end

end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['SWIFT_VERSION'] = '4.2'
    end
  end
end

*请注意,我在末尾使用和不使用 post_install 位进行了尝试 - 但不得不手动将 pods 更改为 4.2,因为对于许多 5.0 尚不支持。

这些是我在尝试构建时遇到的错误:

编辑:我还尝试在一个新的空白项目中获取此 运行,仅将 StreamChat pod 定位为 iOS 11(基本上就像网站上的说明一样ChatDemo) 和 运行 属于同一类型的问题。

关于你的第一个问题,请务必使用 Xcode 10.2 或更高版本和 Swift 5.

无需强制 pods 到 Swift 4.2。尝试从你的 Podfile 中删除这些行,然后你的项目应该编译没有任何错误:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['SWIFT_VERSION'] = '4.2'
    end
  end
end