Xcode找不到Alamofire,错误:没有这样的模块'Alamofire' [英] Xcode can't find Alamofire, error: No such module 'Alamofire'

查看:310
本文介绍了Xcode找不到Alamofire,错误:没有这样的模块'Alamofire'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Github之后将Alamofire包含在我的Swift项目中( https://github.com / Alamofire / Alamofire#cocoapods )指示。

I'm trying to include Alamofire in my Swift project following the github(https://github.com/Alamofire/Alamofire#cocoapods) instruction.

我创建了一个新项目,导航到项目目录并运行此命令 sudo gem install cocoapods 。然后我面临以下错误:

I've created a new project, navigated to the project directory and run this command sudo gem install cocoapods. Then I faced following error:

ERROR:  While executing gem ... (Errno::EPERM)
    Operation not permitted - /usr/bin/pod

搜索后我设法安装 cocoapods 通过运行此命令 sudo gem install -n / usr / local / bin cocoapods

After searching I managed to install cocoapods by running this command sudo gem install -n /usr/local/bin cocoapods

现在我通过 pod init 生成一个pod文件并以这种方式进行编辑:

Now I generate a pod file by pod init and edited it this way:

# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'


target 'ProjectName' do
  # Comment this line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!


  # Pods for Law
    pod 'Alamofire'
  target 'ProjectNameTests' do
    inherit! :search_paths
    # Pods for testing
  end


  target 'ProjectNameUITests' do
    inherit! :search_paths
    # Pods for testing
  end


end

最后我运行 pod install 来安装Alamofire。之后我打开项目并且 import Alamofire 语句给出了以下错误没有这样的模块'Alamofire'

Finally I run pod install to install Alamofire. After that I open the project and import Alamofire statement gives me following error No such module 'Alamofire'

更新-1: pod install 的结果是:

Analyzing dependencies
Downloading dependencies
Using Alamofire (3.4.0)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.


推荐答案

打开.xcworkspace而不是.xcodeproj

Open the .xcworkspace not the .xcodeproj

这篇关于Xcode找不到Alamofire,错误:没有这样的模块'Alamofire'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆