Xcode 和 Cocoapods“没有这样的模块”错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/40601961/
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
Xcode and Cocoapods "No such module" error
提问by Jessica
I recently upgraded to Xcode 8 and an existing project to Swift 3. After having a variety of issues with Cocoapods, I decided to start over from scratch. After running pod deintegrate
and deleting Podfile
, Podfile.lock
, and [Project].xcworkspace
, I had a blank slate as far as Cocoapods was concerned.
我最近升级到 Xcode 8,并将现有项目升级到 Swift 3。在遇到 Cocoapods 的各种问题后,我决定从头开始。在运行pod deintegrate
并删除Podfile
, Podfile.lock
, 和 之后[Project].xcworkspace
,就 Cocoapods 而言,我有一张白纸。
I then took the following actions:
然后我采取了以下措施:
Opened a terminal at the project location and ran
pod init
, thenpod install
(using the stub Podfile thatpod init
creates).This appeared to be successful, but came with the following two warnings:
在项目位置打开一个终端并运行
pod init
,然后pod install
(使用pod init
创建的存根 Podfile )。这似乎是成功的,但伴随着以下两个警告:
[!] The `Xena [Debug]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `Pods/Target Support Files/Pods-Xena/Pods-Xena.debug.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The `Xena [Debug]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `Pods/Target Support Files/Pods-Xena/Pods-Xena.debug.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The `Xena [Release]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `Pods/Target Support Files/Pods-Xena/Pods-Xena.release.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The `Xena [Release]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `Pods/Target Support Files/Pods-Xena/Pods-Xena.release.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
At this point, opening Xcode and building the project gives the "No such module" error, which is entirely expected.
此时,打开 Xcode 并构建项目会出现“No such module”错误,这完全在意料之中。
Following the instructions at this questionsolves this problem and rerunning pod install
is a success.
按照这个问题的说明解决了这个问题,重新运行pod install
是成功的。
Closed Xcode, added the modules I'm using to the Podfile (see below), the ran
pod install
again. According to the terminal output, this is successful.Opened Xcode and built the project. I again receive the "No such module" error, specifically
No such module 'ReactiveCocoa'
I have confirmed that the same problem occurs with SnapKit, Hue, KMPlaceholderTextView, KeychainSwift, and Siren, depending on the order of the import statements. For some reason, none of the Google modules are affected by this problem.
关闭 Xcode,将我正在使用的模块添加到 Podfile(见下文),
pod install
再次运行。根据终端输出,这是成功的。打开Xcode并构建项目。我再次收到“没有这样的模块”错误,特别是
No such module 'ReactiveCocoa'
我已经确认 SnapKit、Hue、KMPlaceholderTextView、KeychainSwift 和 Siren 也会出现同样的问题,具体取决于导入语句的顺序。出于某种原因,没有任何 Google 模块受到此问题的影响。
My Podfile:
我的播客文件:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'Xena' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Xena
pod 'ReactiveCocoa', :git => 'https://github.com/ReactiveCocoa/ReactiveCocoa.git'
pod 'SnapKit', '~> 3.0.2'
pod 'Hue', '~> 2.0.1'
pod 'KMPlaceholderTextView', '~> 1.3.0'
pod 'GooglePlacePicker'
pod 'GooglePlaces'
pod 'GoogleMaps'
pod 'KeychainSwift', '~> 7.0'
pod 'Siren'
target 'XenaTests' do
inherit! :search_paths
# Pods for testing
end
target 'XenaUITests' do
inherit! :search_paths
# Pods for testing
end
end
回答by Munahil
Make sure you are opening .xcworkspace
and not .xcodeproj
file.
确保您正在打开.xcworkspace
而不是.xcodeproj
文件。
You may further look into this post.
您可以进一步查看这篇文章。
Also under : Target > General > Linked Frameworks and Libraries
Make sure your frameworks are there. Even Pods_Xena.framework
is there
同样位于:目标 > 常规 > 链接的框架和库 确保您的框架在那里。甚至Pods_Xena.framework
有
回答by Adriana Carelli
Try:
尝试:
Xcode ->Preferences ->Location ->DerivedData
Xcode ->Preferences ->Location ->DerivedData
open the folder DerivedData and move it to Trash
打开文件夹 DerivedData 并将其移至废纸篓
回答by Диас Ермекбаев
Uncomment the next line to define a global platform for your project
取消注释下一行,为您的项目定义一个全球平台
platform :iOS, '9.0'
Uncommenting the second line in your pod file will help you.
取消注释 pod 文件中的第二行将对您有所帮助。