ios Alamofire 没有这样的模块 (CocoaPods)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32466073/
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
Alamofire No Such Module (CocoaPods)
提问by Anuj Arora
Using Xcode 7
使用 Xcode 7
I am trying to install Alamofire in a sample project. Have used the instructions from Ray Wenderlich's page
我正在尝试在示例项目中安装 Alamofire。使用了Ray Wenderlich 页面上的说明
Only change from above link is the podfile -- which is from GitHub page herebecause the version has been updated. I have also used the Swift 2.0 branch.
上面链接中唯一的变化是 podfile——它来自 GitHub 页面,因为版本已经更新。我还使用了 Swift 2.0 分支。
Below is the snapshop of the error, my pod file and my terminal post installing the pod
下面是错误的快照,我的 pod 文件和我安装 pod 的终端帖子
P.S: I want to use cocoapods to install Alamofire. I don't want to download it from github page
PS:我想用cocoapods来安装Alamofire。我不想从github页面下载它
采纳答案by Suraj
Try this one.
试试这个。
For Swift 2.0 there is no need to add Alamofire.xcodeproj into your xcode. Simply copy and paste source folder from https://github.com/Alamofireand you are done.
对于 Swift 2.0,无需将 Alamofire.xcodeproj 添加到您的 xcode 中。只需从https://github.com/Alamofire复制并粘贴源文件夹即可完成。
or if you want to install Alamofire from Cocoapods then try below code.
或者,如果您想从 Cocoapods 安装 Alamofire,请尝试以下代码。
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'Alamofire', '~> 2.0'
回答by danroose
The Trick for me was to open the .xcworkspace file rather then the original project file itself.
我的诀窍是打开 .xcworkspace 文件而不是原始项目文件本身。
回答by satoshin
working this:
这样做:
Scheme -> Manage Schemes... checked Alamofire checkbox → Build Alamofire scheme
and, if you used Playground , you should change settings Playground:
并且,如果您使用 Playground ,您应该更改 Playground 设置:
View -> Utilities -> Show File Inspector Platform OSX → iOS
回答by Dimitri T
import Alamofire after importing UIKit Then comment it out, build the project first. Uncomment it. (this worked for me, and others, when the other answers did not).
导入 UIKit 后导入 Alamofire 然后注释掉,先构建项目。取消注释。(当其他答案没有时,这对我和其他人有用)。
回答by albogdano
For reference to anyone who comes across this problem in the future:
供以后遇到此问题的任何人参考:
Swift 2.x + CocoaPods 1.x
Swift 2.x + CocoaPods 1.x
Symptoms:build works in Xcode for debug configuration but fails when xcodebuild
is executed from console using pod lib lint
or similar command. The result is error: no such module 'X'
症状:构建在 Xcode 中用于调试配置,但在xcodebuild
使用pod lib lint
或类似命令从控制台执行时失败。结果是error: no such module 'X'
Solution:In MyProject.podspec
add your dependencies without specifying versions:
解决方案:在MyProject.podspec
不指定版本的情况下添加您的依赖项:
spec.dependency "Alamofire"
The Podfile
should also contain the same dependencies. Then run:
该Podfile
还应该包含相同的依赖关系。然后运行:
$ pod install && open MyProject.xcworkspace
You should open .xcworkspace
instead of .xcodeproj
. The build will now work in both Xcode and console and pod lib lint
passes validation.
你应该打开.xcworkspace
而不是.xcodeproj
. 构建现在可以在 Xcode 和控制台中运行并pod lib lint
通过验证。
I wrote this because I was trying to publish a new CocoaPods pod library and had a similar issue but found no answer and also because Google leads to this question.
我写这个是因为我试图发布一个新的 CocoaPods pod 库并且遇到了类似的问题,但没有找到答案,也因为谷歌导致了这个问题。
回答by Xeieshan
My problem was solved using these steps :
使用以下步骤解决了我的问题:
Clean Project Goto Project > Build Setting > Framework Search Path and add
Clean Project 转到 Project > Build Setting > Framework Search Path 并添加
- "$PODS_CONFIGURATION_BUILD_DIR/Alamofire" as non-recursive
- $(inherited) as non-recursive
- $(SRCROOT) as recursive
- “$PODS_CONFIGURATION_BUILD_DIR/Alamofire”作为非递归
- $(inherited) 作为非递归
- $(SRCROOT) 作为递归
回答by sahiljain
Have been facing the same problem, following trick resolved the issue
一直面临同样的问题,以下技巧解决了问题
Go to Manage scheme -> Select pod library that is causing issue -> Build
Change back the scheme to project and then run the app, you are good to go
Note: If you don't see the pod library in the scheme, go to Manage schemeand select the pod library that you would like to build.
注意:如果您在方案中没有看到 pod 库,请转到管理方案并选择您要构建的 pod 库。
回答by Ousseynou NDIOUR
Here is what to do:
这是该怎么做:
- close your project,
- install your pod library,
- then install alamofire.
- 关闭你的项目,
- 安装你的 pod 库,
- 然后安装alamofire。
After you do all things, don't open the file with extension .xcodeproj
but open the file with extension .xcworkspace
做完所有事情后,不要打开带扩展名的文件,.xcodeproj
而是打开带扩展名的文件.xcworkspace
回答by Eric Mentele
回答by ewizard
After doing @satoshin answer, I also had to check the Shared
box on the right hand side of the Manage Schemes
window.
完成@satoshin 回答后,我还必须选中窗口Shared
右侧的Manage Schemes
框。