Xcode找不到Alamofire,错误:没有这样的模块'Alamofire'

编程入门 行业动态 更新时间:2024-10-27 14:34:16
本文介绍了Xcode找不到Alamofire,错误:没有这样的模块'Alamofire'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

I'm trying to include Alamofire in my Swift project following the github(github/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'

本文发布于:2023-11-26 03:39:45,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1632488.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:找不到   模块   错误   Xcode   Alamofire

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!