2017-03-05 28 views
2

我正在Xcode 8.2.1上開發一款應用swift 3的應用程序。我有一些異步任務需要按適當的順序排列,所以我決定使用PromiseKit來達到這個目的。我添加了一個podfile到我的項目目錄並修改,然後使用pod install(通過cocoapods)安裝它。安裝適當的工作作爲我的命令行給了我這個成功消息: enter image description herePromiseKit pod安裝正確,但import PromiseKit返回錯誤?

(這順便說是podfile文本): enter image description here

我加入了框架,我聯繫的框架和庫項目如下圖所示: enter image description here

有了這一切完成後,我希望,我將能夠利用import PromiseKit我viewControllers的頂部,以訪問框架的庫中的函數。然而,輸入import PromiseKit給了我以下錯誤: enter image description here

有誰知道這個問題可能是什麼?

+0

構建一次項目並查看錯誤是否持續。 – ebby94

+0

@ ebby94錯誤確實仍然存在 –

回答

0

所以事實證明,這個特殊問題源於使用PromiseKit的錯誤版本。我正在運行pod install而沒有定義PromiseKit應該是什麼版本,希望這種不明確性將允許安裝選擇最新的版本。 (此外,最初指定的版本,如網站上建議的:

swift_version = "3.0" 
pod "PromiseKit", "~> 4.0" 

將返回一個錯誤,我無法訪問4.0)。此錯誤是:

` 'PromiseKit (~>4.0)' required by 'Podfile' 
None of your spec sources contain a spec satisfying the dependency:... 

這原來是總體問題(我需要使用4.0規範)。爲了擺脫這個錯誤,我跑了下面的命令:

pod repo remove master 
pod setup 
pod install #in the project directory... after modifying the podfile to the code 
#written above... ie. including the '"~> 4.0"' 

雖然回購和安裝需要一些時間。

0

安裝該窗格後,需要打開.xcworkspace文件而不是.xcodeproject。而且,因爲您已經安裝了PromiseKit的窗格,所以不需要再次鏈接框架。只需在xcode中打開.xcworkspace,就可以導入PromiseKit。

+0

我也試過這個。我redid整個過程,並打開.xcworkspace沒有做額外的框架鏈接,我仍然得到錯誤 –