繁体   English   中英

Xcode 8 和 Swift 2.3

[英]Xcode 8 and Swift 2.3

我的 iOS 应用程序是用 Xcode 7.3 开发的。

我想使用 Xcode 8,我正在使用Cocoapods来生成项目。

我现在不想将我的代码迁移到 swift 3.0,我想将 Swift 2.3 用于我的项目代码。

这是我的Podfile

source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!

target 'xxxxx' do
platform :ios, '9.3'
pod 'RESideMenu', '4.0.7'
pod 'Alamofire', '3.4.1'
pod 'AlamofireImage', '2.4.1'
pod 'JSONHelper', '2.1.0'
pod 'SwiftyJSON', '2.3.2'
pod 'ObjectMapper', '1.3.0'
pod 'AlamofireObjectMapper', '3.0.2'
pod 'RealmSwift', '~> 0.97'
pod 'KVNProgress', '2.3'
pod 'CalendarLib', '2.0'
pod 'Charts/Realm', '2.2.5'
pod 'SwiftEventBus', :tag => '1.1.0', :git => 'https://github.com/cesarferreira/SwiftEventBus.git'
pod 'RichEditorView'
pod 'SwiftHSVColorPicker'
pod 'Google/Analytics'
pod 'Fabric'
pod 'Crashlytics'
end

如果我将Use Legacy Swift Language Version 设置为YES则会出现错误事件

是否可以将 Pod 更新到 Swift 3 版本,并且我的项目仍然使用 Swift 2.3?

你不能,你要么使用 Swift 2.3 或 Swift 3.0 中的所有内容。 我给你的提示是,如果你不想更新到 Swift 3.0,那么搜索所有依赖项以查找支持 2.3 的分支或版本。

PS:这是 Xcode :)

您可以使用这样的 pod:请在您的项目设置中添加 SWIFT_VERSION,然后像这样更新您的 pod:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!

target 'xxxxx' do
platform :ios, '9.3'
pod 'RESideMenu', '4.0.7'
pod 'Alamofire', '3.4.1'
pod 'AlamofireImage', '2.4.1'
pod 'JSONHelper', '2.1.0'
pod 'SwiftyJSON', '2.3.2'
pod 'ObjectMapper', '1.3.0'
pod 'AlamofireObjectMapper', '3.0.2'
pod 'RealmSwift', '~> 0.97'
pod 'KVNProgress', '2.3'
pod "CalendarLib", '2.0'
pod 'Charts/Realm', '2.2.5'
pod 'SwiftEventBus', :tag => '1.1.0', :git => 'https://github.com/cesarferreira/SwiftEventBus.git'
pod "RichEditorView"
pod 'SwiftHSVColorPicker'
pod 'Google/Analytics'
pod 'Fabric'
pod 'Crashlytics'
end

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

然后使用 install pods 命令。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM