gpt4 book ai didi

ios - 如何解决 Xcode 构建错误 "No such module RxCocoa"?

转载 作者:行者123 更新时间:2023-12-01 15:52:23 24 4
gpt4 key购买 nike

我对使用 Xcode 进行 Mac/iOS 开发还很陌生,在构建我的应用程序时遇到了麻烦。我在那个问题上工作了 4 天,但我没有更多的想法来找到原因。

该应用程序有 6 个项目,捆绑在一个 xcworkspace 中。我通过 cocoapods 和终端使用命令 pod install RxSwift、RxCocoa、OMGHTTPURLRQ、PromiseKit 和 SVWebViewController 成功添加。没有依赖项的项目可以成功构建。在 *.swift 文件中使用命令“import RxCocoa”和“import RxSwift”的两个项目(库)失败并出现错误“No such module 'RxCocoa'”。

我阅读了一些 Stackoverflow 帖子和 RxSwift Git 文档来解决这个问题,但没有成功。

Screenshot of build error and added reference

Podfile 定义:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.1'
use_frameworks!
target 'CheckMyBus' do
pod "OMGHTTPURLRQ", "~> 3.1.2“
pod "RxSwift", "~> 2.3.0"
pod 'RxCocoa', '~> 2.3.0'
pod 'PromiseKit', '~> 3.2.1'
pod 'SVWebViewController', '~> 0.2‘
end

通过终端安装 Pod:

MacMinis-Mac-mini:CheckMyBus MacMini$ pod install
Analyzing dependencies
Downloading dependencies
Using OMGHTTPURLRQ (3.1.3)
Using PromiseKit (3.2.1)
Using RxCocoa (2.3.1)
Using RxSwift (2.3.1)
Using SVWebViewController (0.2)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There are 5 dependencies from the Podfile and 5 total pods installed.

[!] Your Podfile has had smart quotes sanitised. To avoid issues in the future, you should not use TextEdit for editing it. If you are not using TextEdit, you should turn off smart quotes in your editor of choice.

[!] The `CheckMyBus [Debug]` target overrides the `EMBEDDED_CONTENT_CONTAINS_SWIFT` build setting defined in `Pods/Target Support Files/Pods-CheckMyBus/Pods-CheckMyBus.debug.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.

[!] The `CheckMyBus [Release]` target overrides the `EMBEDDED_CONTENT_CONTAINS_SWIFT` build setting defined in `Pods/Target Support Files/Pods-CheckMyBus/Pods-CheckMyBus.release.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
MacMinis-Mac-mini:CheckMyBus MacMini$

谁能帮帮我?

最佳答案

我解决了这个问题。解决方案非常简单,但我之前没有找到将 pod 与多个库一起使用的文档。

我忘记在库的 Podfile 中添加 pod 定义。

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.1'
workspace 'MyWorkspace'
use_frameworks!

target 'MainProj' do
pod "OMGHTTPURLRQ", "~> 3.1.2“
pod "RxSwift", "~> 2.3.0"
pod 'RxCocoa', '~> 2.3.0'
pod 'PromiseKit', '~> 3.2.1'
pod 'SVWebViewController', '~> 0.2‘
project 'MainProj'
end

target 'Lib1' do
pod "RxSwift", "~> 2.3.0"
pod 'RxCocoa', '~> 2.3.0'
project 'Lib1/Lib1.xcodeproj'
end

target 'Lib2' do
pod "OMGHTTPURLRQ", "~> 3.1.2“
pod "RxSwift", "~> 2.3.0"
pod 'RxCocoa', '~> 2.3.0'
project 'Lib2/Lib2.xcodeproj'
end

关于ios - 如何解决 Xcode 构建错误 "No such module RxCocoa"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42056416/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com