我目前在Swift编码,我有一个错误:
没有这样的模块
但我不明白,因为这个模块在我的项目中,在“链接框架和库”和“嵌入式二进制文件”中声明。
框架是在Objective-C中,所以我为它写了一个桥标头。
请问,如何让Xcode识别框架?
我目前在Swift编码,我有一个错误:
没有这样的模块
但我不明白,因为这个模块在我的项目中,在“链接框架和库”和“嵌入式二进制文件”中声明。
框架是在Objective-C中,所以我为它写了一个桥标头。
请问,如何让Xcode识别框架?
当前回答
有几个潜在的错误配置可能会导致这个问题,
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.
其他回答
实际上,通过添加到build-debug.xconfig的末尾,我更容易地解决了这个问题
#包括“. ./Pods/目标支持文件/Pods- iap /Pods- iap .debug.xcconfig"
一直到build-release.xconfig的末尾
#包括“. ./Pods/目标支持文件/Pods- iap /Pods- iap .release.xcconfig"
因为这些文件已经定义了PODS_ROOT和相关的构建变量。
没想到这竟然起作用了。我的解决办法是……
构建设置->框架搜索路径->高亮调试->按delete ->它应该自动填写一个路径。->释放时执行同样的操作
结果:
在我的例子中: 该问题只发生在Xcode 12.4,而不是Xcode 13。 测试目标的一个框架在我为arm64模拟器支持重新构建框架后给出了这个错误(在XCFramework格式)。我通过更新框架搜索路径中的路径来修复它
"$(SRCROOT)/Carthage/Build/WireTesting.xcframework/ios-x86_64-simulator"
to
"$(SRCROOT)/Carthage/Build/WireTesting.xcframework/ios-arm64_x86_64-simulator"
对于Xcode 10+和项目,还有一个建议。创建Xcode版本< 10,2。包含带有主项目所依赖的框架的子项目。问题是Xcode会将编译后的框架放在子项目中指定的目录中,这可能与主项目的构建目录不同。
检查文件>项目设置。现在,单击“Advanced…”并选择“Legacy”以外的内容作为构建路径,例如,“Unique”。在这种情况下,Xcode将把所有构建的组件放到一个文件夹中,它应该能够找到“丢失”的模块。
您将依赖项(模块)添加到pod中,但没有版本(特定或范围)。 请定义版本,运行pod install,并打开。xcworkspace文件,而不是。xcodeproj文件