2016-10-03 101 views
0

我在我的XCode項目中使用Alamofire使用Swift 2。在XCode 8發佈後,我需要使用Swift 3編譯我的應用程序。我用Alamofire在我的項目,所以我在Podfile作出如下改變它使用斯威夫特3:更新Alamofire使用Swift 3

pod 'Alamofire', 
:git => 'https://github.com/Alamofire/Alamofire.git', 
:branch => 'swift3' 

這給了我一個錯誤,當我運行一個pod update說明該分支是找不到的。我想知道是否還有其他需要在我執行Pod更新或其他分支URL之前運行的其他內容。

+0

的swift3版本已經與主分支合併。只要確保你使用的是4.0+版本,你應該沒問題。 – Rog

+0

好的。我最初(很多次)試過它,它不會工作。不知何故,現在。 XCode:/非常感謝! –

+0

嘗試更新特定的pod文件somtimes,它會嘗試更新podfile中列出的每個pod,因此請嘗試「pod update Alamofire」 –

回答

0

首先

  1. 更新您的Cocoapod pod repo update

  2. 打開Podfile

  3. 添加這個,Alamofire需要使用iOS 9.0 Swift3

```

post_install do |installer| 
    installer.pods_project.targets.each do |target| 
    target.build_configurations.each do |config| 
     config.build_settings['ENABLE_BITCODE'] = 'NO' 
     config.build_settings['SWIFT_VERSION'] = '3.0' 
    end 
    end 
end 
  • 添加pod Alamofire

  • pod install安裝

  • 然後Alamofire 4.0.1應安裝