我目前在Swift编码,我有一个错误:

没有这样的模块

但我不明白,因为这个模块在我的项目中,在“链接框架和库”和“嵌入式二进制文件”中声明。

框架是在Objective-C中,所以我为它写了一个桥标头。

请问,如何让Xcode识别框架?


当前回答

这是最后对我有用的方法。我不得不做这一切,这很蹩脚,但这是我能找到的唯一有效的方法。

在确保图书馆被列在链接框架和图书馆。如果没有,你可以点击+,希望能看到你的框架/pod。

在方案图标中单击您的项目(见下图)

然后你会看到你的关注点框架:

单击“管理方案”。

然后你会看到如下内容:

勾选框架的方框,单击自动创建方案,然后关闭。

然后尝试再次导入框架/pod。

这对我很管用。

其他回答

我也遇到过这个问题。对我来说,修复是两个项目之间的存档方案不匹配。我有一个xcworkspace与框架项目和应用程序项目。问题在于,在我的应用程序的存档方案中,我使用了与框架的存档方案不同的构建配置。我把两个构建配置都设置为发布,这就解决了这个问题。

有几个潜在的错误配置可能会导致这个问题,

Please confirm that you have opened the .xcworkspace but not .xcodeproj file. Also make sure you have build Social first before you build TriviaApp. Make sure that iOS Deployment Target is set same for all modules with main app. For example is TriviaApps deployment target is set to 9.0, Socials deployment target also need to be set to 9.0. Make sure your main module (TriviaApp) and your used framework (Social) have same set of configurations. i.e. If your Project has three configurations, Debug, Release, ReleasePremium than your Social framework also need to have three configurations Debug, Release, ReleasePremium. Also make sure that the archive configuration is set same for both TriviaApp and Social. i.e. if your TriviaApps archive scheme is set to ReleasePremium, your Socials archive scheme also need to be set into ReleasePremium. Please assure that you do not need to import Social in each .swift files when its already added in the Bridging-Header.h. In case of issue came from Pod files, make sure you have uncommented #use_frameworks! into use_frameworks! from you Podfile. Sometime re installing pod works if Social has any dependency on pods. If none of the above steps works, delete your derived data folder and try re building.

我尝试了以上的解决方案,但不幸的是,没有一个对我有帮助。我后来做了什么

关闭项目。 从终端,进入工程目录并运行以下命令: Git重置-硬源/主(我想在主分支改变。) git获取 Git checkout master Git拉源主 打开项目(当然是从Xcode) 清除生成和删除派生数据。 再次构建项目。

是的,我知道有些命令是多余的。但花两天时间揪头发比那些步骤糟糕多了。

对我来说,问题在于项目文件缺少这个文件“coursesX.xcworkspace”

当我添加它并重新打开项目时,一切都工作得很好

我用

链接的框架和库

将框架添加到Workspace文件夹的顶部。讨厌鬼。