我在使用Xcode开发Mac / iOS时非常新,我在构建应用程序时遇到了麻烦。我在这个问题上工作了4天,但我没有更多想法找到原因。
该应用程序有6个项目,捆绑在xcworkspace中。我通过cocoapods和via终端添加了命令pod安装RxSwift,RxCocoa,OMGHTTPURLRQ,PromiseKit和SVWebViewController。没有依赖项的项目可以成功构建。在* .swift文件中使用命令“import RxCocoa”和“import RxSwift”的两个项目(库)失败,错误“没有这样的模块'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$
有人能帮助我吗?
答案 0 :(得分:0)
我解决了这个问题。解决方案非常简单,但我之前没有找到使用带有多个库的pod的文档。
我忘了在Podfile中为库添加pods定义。
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
答案 1 :(得分:-2)
注意:构建有效,但不能测试!说明:CocoaPods Podfile配置问题。给定的pod /框架是为非测试主要目标指定的,甚至可能是针对(单元)测试目标的,但不是针对UI测试目标的!例如:platform:ios,'9.0'use_frameworks!目标'Xyz'做pod'MessageK…