使用 Xcode 8 和 Swift 3.0 获得“没有这样的模块‘RxSwift’”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/41347705/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Getting "No such module 'RxSwift'" with Xcode 8 and Swift 3.0
提问by Jing Bian
I try to use RxSwift in my project. My podfile looks like below, ↓
我尝试在我的项目中使用 RxSwift。我的 podfile 如下所示,↓
I got this error:
我收到此错误:
This is my Link Binary With Librariesstatus:
这是我的链接二进制与库状态:
I have tried to fix it for over three hours. But the answers on the site don't work for me...
我试图修复它超过三个小时。但是网站上的答案对我不起作用...
回答by Parth Adroja
Replace your Podfile like below:
像下面这样替换你的 Podfile:
platform :ios, '9.0'
target 'RxStudy' do
use_frameworks!
pod 'RxSwift'
pod 'RxCocoa'
target 'RxStudyTests' do
#Add pod here if you want the access of pod in Tests target.
#Example: pod 'RxSwift'
end
target 'RxStudyUITests' do
#Add pod here if you want the access of pod in Tests target.
#Example: pod 'RxSwift'
end
end
Problem with your Podfile is that you are trying to add the pods in the Tests target and not to actual project target. After changing the file as above install the Pods again and then run the project even if you get "No such module error" because it might happen for the first time.
您的 Podfile 的问题在于您试图将 Pod 添加到测试目标中而不是实际项目目标中。如上所述更改文件后,再次安装 Pod,然后运行项目,即使您收到“没有此类模块错误”,因为它可能是第一次发生。
回答by Abedalkareem Omreyh
You are inserting the pods in the tests target, not in the project target.
您将 pod 插入到测试目标中,而不是在项目目标中。
To solve this problem move the pods to the project target as below:
要解决此问题,请将 pod 移动到项目目标,如下所示:
# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
target 'RxStudy' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for ProjectName
# Insert your pods here
pod 'RxSwift'
pod 'RxCocoa'
target 'RxStudyTests' do
inherit! :search_paths
# Pods for testing
end
target 'RxStudyUITests' do
inherit! :search_paths
# Pods for testing
end
end