Swift 无法在 Xcode 8 上通过 cocoapods 导入 SwiftyJSON 和 Alamofire

标签 swift cocoapods alamofire xcode8 swifty-json

我需要在我的 Swift 项目中使用 SwiftyJSON 和 Alamofire,所以我使用 cocoapods。

我的 Podfile 是:

platform :ios, '9.0'
target 'SwiftSalt' do
    use_frameworks!
    pod 'SwiftyJSON'
    pod 'Alamofire', '~> 4.0'
end
post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['SWIFT_VERSION'] = '3.0'
        end
    end
end

另外,我确实添加了 USER_HEADER_SEARCH_PATHS , $(PODS_ROOT)/**。

但是,还是没有成功。它说“没有这样的模块‘SwiftyJSON’”。模块是什么意思?

最佳答案

将 config.build_settings 更改为 swift 2.3。因为 swiftyJSON 仍在 swift 2.3 上

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

结束

关于Swift 无法在 Xcode 8 上通过 cocoapods 导入 SwiftyJSON 和 Alamofire,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39584390/

相关文章:

ios - 什么是 Flurry 的正确桥接头?

cocoapods - 如何向 Cocoapod 添加 Cocoapod 依赖项?

json - 使用 Swift 2 的 Alamofire POST 请求

ios - 使 TabView 在 SwiftUI 上不透明会在顶部产生一个新 View

ios - NSTimer 无法正常触发

iOS Flip UIView 无阴影

ios - Alamofire 网络事件指示器未显示

ios - 光标上下移动

ios - 谷歌地图 Swift 2 cocoapods

ios - 如何使用操作查询发出多个 Alamofire 请求