3

我对使用 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 文档来解决这个问题,但没有成功。

构建错误的屏幕截图和添加的参考

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$ 

有谁能够帮我?

4

2 回答 2

0

我解决了这个问题。解决方案非常简单,但我之前没有找到将 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

于 2017-02-06T20:37:19.150 回答
-2

注意:构建有效,但不是测试!说明:CocoaPods Podfile 配置问题。给定的 pod/framework 是为非测试主要目标指定的,甚至可能是为(单元)测试目标指定的,但不是为 UI 测试目标指定的!例如:平台:ios,'9.0' use_frameworks!目标 'Xyz' 做 pod 'MessageK...</p>

于 2019-08-06T20:04:31.813 回答