2016-11-30 127 views
1

我在iOS开发新的,和我的应用程序和Xcode 7.3的XCode 8和雨燕2.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版本到YES

是否有可能更新荚迅速3版,并仍然使用SWIFT 2.3为我的项目?

感谢您的帮助

+1

恐怕这不是如何工作的。您可以使用支持2.3版本的旧分支的旧版本。 – Wolverine

回答

2

你不能,你无论是在雨燕2.3或3.0雨燕使用了一切。我的提示是,如果你不想更新到Swift 3.0,那么搜索你所有的依赖关系来查找支持2.3的分支或版本。

PS:这是Xcode的:)

+0

谢谢!如果一个库不支持swift 3,它可以在应用程序中使用吗?事件,如果这个库是在迅速2版本? –

+0

从swift 2.2到2.3没有什么大的变化,如果Pod没有Swift 2.3,你可以尝试自己转换:) –

-2

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

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 

然后用安装荚命令。

+0

我无法添加SWIFT_VERSION,Xcode给出了这样的错误:“已经有另一个设置名称SWIFT_VERSION。请输入不同的名称“。但是,这个变量不存在! –

+0

@FlorianMacLlade ...你需要在Xcode 7中手动添加这个 –

+0

我认为这就是我所做的。 –