Alamofire failing to import
我正在使用swift 2.1在Xcode 7.2中开发移动应用程序。我通过cocoapods安装了Alamofire,并在我的Podfile中指定了Alamofire 3.0版,如下所示:
1 2 3 4 5 6 7 8 | source 'https://github.com/CocoaPods/Specs.git' platform :ios, '8.0' use_frameworks! target 'SeniorSeminar' do pod 'Alamofire', '~>3.0' end |
在安装Alamofire之后,我打开了.xcworkspace并尝试将Alamofire导入到我的模型文件之一中。我收到错误:"没有这样的模块'Alamofire'"。我去看了看Podfile.lock,它显示Alamofire 4.0版已实际安装。我不认为版本4与我正在使用的xcode和swift的版本兼容,并且我宁愿不更新这两个版本,以免产生大量我没有时间修复的错误。是否有人对如何卸载Alamofire -version 4和强制安装版本3有任何建议?还是有什么变通的方法,为什么我的项目无法让我导入Alamofire?
-
删除您的
pods 目录并在您的项目上执行清理。 -
将您的podfile pod安装行更改为
- 再次安装您的Pod
- 执行构建! -在安装框架之前,必须先构建项目,然后才能导入框架。容易忘记。
I Hope you followed All the Steps for Installing ** Alamofire** correctly and have latest version installed
如果不先执行此步骤,则
Step 1 :
Pod init Step 2 :
Open podfile Step 3 : add this in your podfile
pod 'Alamofire' Step 4 :
Pod install
然后执行以下步骤:
第1步:
Import Alamofire
第2步:
Keep on Pressing Build ( Cmd + B)
步骤3:
If Issue Continues then just close your Current program for a moment
by completely closing it (cmd + Q) and then Re-start it and Follow
Step 1 & 2 This will work
谢谢