Ios 我能';t在Xcode 8中运行Alamofire

Ios 我能';t在Xcode 8中运行Alamofire,ios,swift,xcode,cocoapods,alamofire,Ios,Swift,Xcode,Cocoapods,Alamofire,不久前,我在Xcode 7中创建了一个项目。现在我必须对它做一些修改。它是在swift2.3中创建的,我在Alamofire中使用它。现在我已经在Xcode 8.2.1上更新了Xcode,而Swift版本是3 我现在遇到了很多错误,我不知道如何使它再次工作 我找到了同样可能的解决方案,但对我来说并不适用 我在1.2.0上更新了我的可可豆豆。还不够。 我将Alamofire更新到最新版本。同样的结果。 我试图转换为当前的Swift版本。还是不好 我找到了要放在Podfile末尾的代码 post_i

不久前,我在Xcode 7中创建了一个项目。现在我必须对它做一些修改。它是在
swift2.3
中创建的,我在
Alamofire
中使用它。现在我已经在
Xcode 8.2.1
上更新了Xcode,而
Swift版本是
3

我现在遇到了很多错误,我不知道如何使它再次工作

我找到了同样可能的解决方案,但对我来说并不适用

我在
1.2.0
上更新了我的
可可豆豆。还不够。
我将Alamofire更新到最新版本。同样的结果。
我试图转换为当前的
Swift版本
。还是不好

我找到了要放在
Podfile
末尾的代码

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
这是我的
Podfile
。也许有帮助

    # platform :ios, '9.0'

target 'LeTrans Swift' do

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

   pod 'KRProgressHUD'

   pod 'SwiftyJSON'

   pod 'GoogleMaps'
   pod 'GooglePlaces'
   pod 'GooglePlacePicker'

end
首先 如果更新为使用xcode8和swift3,则应使用Alamofire 4.x版本,而不是使用Alamofire 3.x(适用于swift 2.x)

Swift2.2或Swift2.3中使用的3.5.0版本,因此您应该将版本升级到4.x

试一试

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

改为


pod'Alamofire',“~>4.3”

从项目中完全删除pod文件并重新安装。按照重新安装的步骤进行操作。我在此附上一份pod文件样本。我已经在Xcode 8.2.1中对其进行了测试。希望它能帮助你

  • 项目文件的cd路径
  • pod初始化
  • 打开一个Xcode文件
  • 将pod文件名如下所示
  • 吊舱安装
  • 请遵循下面给出的示例pod文件

    # Uncomment this line to define a global platform for your project
    
    source 'https://github.com/CocoaPods/Specs.git'
    platform :ios, '10.0'
    use_frameworks!
    
    target 'Ebook' do
      # Comment this line if you're not using Swift and don't want to use dynamic frameworks
    
      # Pods for Ebook
        pod 'Alamofire', '~> 4.0'
    
      target 'EbookTests' do
        inherit! :search_paths
        # Pods for testing
      end
    
      target 'EbookUITests' do
        inherit! :search_paths
        # Pods for testing
       end
    
    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
    
    swift 3.0和Xcode 8或更高版本中的最新Alamofire吊舱版本支持所有版本

      pod 'Alamofire', '~> 4.6'