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

没有这样的模块

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

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

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


当前回答

确保Scheme中的“在构建中查找隐式依赖项”选项是打开的!

其他回答

当我使用Cocoapods添加两个框架时,我得到了相同的错误。如果我们在项目中使用Pods,我们应该使用xcodeworkspace而不是xcodeproject。 为了通过xcodebuild运行项目,我在xcodebuild命令中添加了-workspace <workspacename>参数,它工作得很好。

Another possible cause in XCode 10 can be the Supported Platforms sometimes gets changed to macOS and the Valid Architectures gets changed to i386 x86_64 for the Pods Projects. Assuming the project is for iOS, then select the Pods Project and change the Supported Platforms to iOS and the Valid Architectures to arm64 arm64e armv7 armv7s, You could do each of the Targets, however that takes longer if you have more than one Pod. Also the Swift version of frameworks in written Swift sometimes gets set to the wrong version.

我赢得了“没有这样的模块”错误的最愚蠢原因奖。在我的例子中,我手工构建了包含的框架,并将其复制到我的项目目录中。我的框架搜索路径设置正确,框架也被正确地添加到项目中。

当我归档我正在构建的框架时,我使用“Show in Finder”将我带到派生数据中的发布文件夹。但是我没有注意到这个文件夹只包含框架的别名,而不是框架本身。原始框架仍然在我的派生数据目录中,所以后来当我清除派生数据时,框架被删除了,但我的项目不知道这一点。

重新归档框架,遵循别名到实际框架,并将其复制到我的项目目录中,这是可行的。

如果你使用迦太基,建筑设置中的框架通常是不变的

$ (PROJECT_DIR) /迦太基/构建/ iOS

如果你运行carthage update—platform ios—no- Build(为了节省时间),Build文件夹中的文件将不会被重新创建,那么这些模块将无法用于XCode。

以我为例,我运行了carthage update平台ios,然后我的问题就解决了。

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

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