我跟着的Alamofire
的指令github,總是建立自己的錯誤:沒有這樣的模塊「Alamofire」
我創建了一個名爲cocoapods-test
& Xcode的項目,我關閉了它。
我去項目文件夾運行pod init
命令,它生成一個Podfile。然後,我添加以下代碼到Podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'Alamofire', '~> 3.0'
然後,我運行命令pod install
,這是導致終端:
Updating local specs repositories
CocoaPods 1.0.0.beta.6 is available.
To update use: `gem install cocoapods --pre`
[!] This is a test version we'd love you to try.
For more information see http://blog.cocoapods.org
and the CHANGELOG for this version http://git.io/BaH8pQ.
Analyzing dependencies
Downloading dependencies
Installing Alamofire (3.3.0)
Generating Pods project
Integrating client project
[!] Please close any current Xcode sessions and use `cocoapods-test.xcworkspace` for this project from now on.
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.
然後,在我的項目文件夾中有一個新的文件名爲cocoapods-test.xcworkspace
。我雙擊它再次打開我的xcode,我可以看到Alamofire模塊。
然後,我打開了我的項目ViewController
類和import Alamofire
。但不管我多少次清洗&內置,我總是得到錯誤No such module 'Alamofire'
。下面是截圖:
爲什麼我得到這個問題,但我也跟着一步的指示一步?
(我用XCode 7.2.1
,Swift 2.1.1
& Alamofire 3.3.0
)
======= UPDATE ========
我試圖@LK楊的回答,取消import Alamofire
,然後再清理&身材,我從Alarmofire一堆編譯器錯誤的:
「您需要將該庫添加到」鏈接二進制庫「部分。」 http://stackoverflow.com/questions/25817479/cannot-install-alamofire-in-new-xcode-project-no-such-module-alamofire – YarGnawh
@YarGnawh,不,您提供的鏈接是完全不同的安裝方式Alamofire。它下載庫,但我正在使用Alamofire github建議的方式,這是通過cocoapod工具。他們是不同的。在「Link Binary With Library」中,我甚至沒有看到Alamofire框架。因爲我以另一種方式安裝它,請閱讀我的文章,我已經一步步地告訴我如何安裝它。 –
http://stackoverflow.com/a/40360050/1804274上的說明解決了我的問題 – Dudling