Alamofire无法正常工作(Swift / Xcode 8)

我试图导入Alamofire到我的项目时(Cocoapods不为我工作,所以我必须手动导入它)时出现以下错误。

无论如何,我正在使用XCode 8和Swift 2.3,我得到这些错误:

使用未解析的标识符kSecTrustResultProceed

上下文类型AnyObject不能与数组文字一起使用

更新:我清理XCode,下载最新版本的Alamofire,并重新启动我的电脑。 现在,XCode似乎给了我相互矛盾的错误(图片供参考) 无法强制展开非可选类型String的值 可选类型字符串的值?不解开 谢谢!

截至16年9月初,您需要在Podfile中使用以下内容:

pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :tag => '3.5.0' 

指向swift2.3分支不再起作用,因为该分支已被删除。 标签“3.5.0”指向支持Swift 2.3的主版本上的最后一个版本。

在Xcode 8中使用Swift 2.3

在这里输入图像说明

在这里输入图像说明

Pod文件

  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 

有关Xcode 8 + Swift 2.3支持Alamofire的更多信息: https : //github.com/Alamofire/Alamofire/pull/1313

尝试更新您的窗格
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :tag => '3.5.0' (更新)

更新:如果您对保持Xcode7兼容性感兴趣,并且仍然能够针对iOS10 / swift 2.3进行开发,请遵循以下指南: http ://radex.io/xcode7-xcode8/