使用Xcode遇到錯誤“沒有這樣的模塊”,但是框架在那裏

本文翻譯自:Getting error “No such module” using Xcode, but the framework is there

I'm currently coding in Swift, and I've got an error: 我目前正在使用Swift進行編碼,但出現錯誤:

No such module Social 沒有這樣的模塊社交

But I don't understand, because the module is in my project, declared in "Linked frameworks and Libraries" and in "Embedded Binaries". 但是我不明白,因爲該模塊在我的項目中,在“鏈接的框架和庫”和“嵌入式二進制文件”中聲明。

The frameworks is in Objective-C, so I wrote a Bridge Header for it. 這些框架位於Objective-C中,因此我爲此編寫了一個橋頭。

Please, how can I make Xcode recognize the framework? 請,如何使Xcode識別框架?

錯誤模塊

項目

鏈接框架,庫

頭橋


#1樓

參考:https://stackoom.com/question/1zmM7/使用Xcode遇到錯誤-沒有這樣的模塊-但是框架在那裏


#2樓

Assuming the Framework really is there and in the path, etc... delete the ~/Library/Developer/Xcode/DerivedData/ModuleCache directory (and clean the project and delete the project-specific derived data for good measure). 假設Framework確實存在並且在路徑中,等等,...刪除〜/ Library / Developer / Xcode / DerivedData / ModuleCache目錄(並清理項目並刪除項目特定的派生數據,以備不時之需)。

When you do the standard cleanup, the ModuleCache directory doesn't get rebuilt. 當您執行標準清理時,不會重建ModuleCache目錄。


#3樓

I'm not sure why this happens, but one way to solve your issue is to go into your build settings and defining the Framework Search Paths to a folder which contains the frameworks in question. 我不確定爲什麼會這樣,但是解決您的問題的一種方法是進入構建設置,並定義指向包含相關框架的文件夾的框架搜索路徑 If the frameworks are placed in your project directory, simply set the framework search path to $(SRCROOT) and set it to recursive. 如果將框架放置在您的項目目錄中,只需將框架搜索路徑設置爲$(SRCROOT)並將其設置爲遞歸。


#4樓

Ok, how the same problem was resolved for me was to set the derived data location relative to the workspace directory rather than keeping it default. 好的,對我來說,解決同一問題的方法是設置相對於工作區目錄的派生數據位置,而不是將其保留爲默認值。 Go to preferences in xcode. 轉到xcode中的首選項。 Go to locations tab in preferences and set Derived data to Relative. 轉到首選項中的“位置”選項卡,並將“派生數據”設置爲“相對”。 Hope it helps. 希望能幫助到你。


#5樓

I am not quite sure why Martin R 's answer in the comments for the question is so disregarded: 我不太確定爲什麼馬丁·R在問題評論中的回答如此被忽略:

Make sure that you tried simply skipping import of the framework as it is already added with the bridging header . 確保已嘗試僅跳過框架的導入,因爲該框架已與橋接頭一起添加

Hope this helps 希望這可以幫助


#6樓

In case it's Friday afternoon or anytime after 1am: 如果是星期五下午或凌晨1點之後的任何時間:

Opening xcodeproj instead of xcworkspace will cause an error like this... 打開xcodeproj而不是xcworkspace會導致這樣的錯誤...

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章