gpt4 book ai didi

ios - 具有 Swift 4 依赖项的 Swift 3 Cocoapod

转载 作者:行者123 更新时间:2023-11-30 11:17:14 26 4
gpt4 key购买 nike

我正在尝试更新我的 Swift 3 pod 之一中的依赖项。有问题的依赖项是 Socket.IO-Client-Swift。我想将其从 Swift 3 版本升级到最新的 Swift 4 版本。

如果我将 Socket.IO-Client pod 的“Swift Language Version”设置为 4.1,它在 Xcode 中工作正常。它构建没有任何问题。

当我尝试 lint podspec 或推送 podspec 时,我收到错误,因为它看起来像是尝试使用 Swift 3 编译 Socket.IO。

ERROR | [iOS] xcodebuild: Socket.IO-Client-Swift/Source/SocketIO/Client/SocketIOClient.swift:111:39: error: cannot call value of non-function type 'Bool'

...

ERROR | [iOS] xcodebuild: Socket.IO-Client-Swift/Source/SocketIO/Client/SocketIOClient.swift:471:39: error: cannot call value of non-function type 'Bool'

有没有办法让 cocoapods 使用 Swift 4 编译依赖项(Socket.IO-Client-Swift),同时使用 Swift 3 来处理其他需要它的东西?

最佳答案

在您的 pod 文件中添加以下行指定您的 pod 名称

post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if target.name == 'Your-Pod-Name'
config.build_settings['SWIFT_VERSION'] = '4.0' //use required pod version here
end
end
end

结束

完成后,运行命令“pod install”

关于ios - 具有 Swift 4 依赖项的 Swift 3 Cocoapod,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51632232/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com