I am getting the following errors when trying to import Alamofire into my project (Cocoapods isn't working for me, so I have to manually import it).
Anyway, I'm using XCode 8 and Swift 2.3, and I'm getting these errors:
Update: I cleaned XCode, downloaded the latest version of Alamofire and restarted my computer. Now, XCode seems to be giving me conflicting errors (pictures for reference)
Thanks!
As of early September '16, you need to use the following in your Podfile:
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :tag => '3.5.0'
Pointing to the swift2.3 branch no longer works, as that branch has been deleted. The tag '3.5.0' points to the last revision on master that supports Swift 2.3.
Use Swift 2.3 in Xcode 8
Pod file
source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
target 'ProjectName' do
pod 'Alamofire'
pod 'Contentful'
pod 'ContentfulDeliveryAPI'
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'
end
end
end
More information about Xcode 8 + Swift 2.3 support for Alamofire: https://github.com/Alamofire/Alamofire/pull/1313
Try updating your pod to
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :tag => '3.5.0'
(Updated)
Update: This is a good guide to follow if you're interested in keeping Xcode7 compatibility, and still be able to target iOS10/swift 2.3 for development: http://radex.io/xcode7-xcode8/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.