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

没有这样的模块

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

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

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


当前回答

解决苹果iOS xcode Version 12.3 (12C33) Webview问题

简单地做3步:

使用.xcodeproj打开项目 Xcode辞职 从.xcworkspace重新打开项目

全部完成

其他回答

大多数其他答案都是针对CocoaPods或迦太基用户的。如果你不使用这些,但只是想在你的项目中删除一个框架并链接它,它将需要在框架搜索路径中。

系统框架已经在搜索路径(即/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/ sdk/ iPhoneOS${version}.sdk/ system /Library/ frameworks /)。如果您试图使用的文件不在此路径中,则需要将它们的路径添加到Build Settings中的FRAMEWORK_SEARCH_PATHS中。


为什么XCode不知道在哪里找到它,即使你左边面板上的框架在右边面板的标识和类型中列出了一个位置和完整的路径?那我不知道。

如果你是面向tvOS这样的平台创造游戏,请确保你选择了一个Apple TV模拟器。

使用iOS模拟器创建tvOS应用时,我就犯了这个错误。花了大半个小时寻找各种构建问题……哎。

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

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.

我在加载FacebookSDK时遇到了类似的问题,我添加了~/Documents/FacebookSDK(搜索你的框架在哪里)到构建设置中的框架搜索路径,之后我就可以导入FBSDKShareKit模块了