git 找不到 Alamofire 框架

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26335453/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 10:27:55  来源:igfitidea点击:

Alamofire framework not found

gitxcode6alamofire

提问by Joffrey Outtier

I am trying to install alamofire into my project so I can upload images to my server, however I cannot seem to find the alamofire.frameworkfile. I have downloaded the git twice, done the installation instructions on https://github.com/Alamofire/Alamofirebut when it comes to step 6, how and where do I get the alamofire.frameworkfile?

我正在尝试将 alamofire 安装到我的项目中,以便我可以将图像上传到我的服务器,但是我似乎找不到该alamofire.framework文件。我已经下载了两次 git,完成了安装说明,https://github.com/Alamofire/Alamofire但是当涉及到git时step 6,我如何以及从哪里获取alamofire.framework文件?

I am new to this, so sorry if it is a stupid question.

我是新手,很抱歉,如果这是一个愚蠢的问题。

回答by harishannam

You have to open yourprojectname.xcworkspace

你必须打开 yourprojectname.xcworkspace

You might get this error if you are opening your .xcworkproj instead of workspace

如果您打开 .xcworkproj 而不是工作区,您可能会收到此错误

回答by Joffrey Outtier

  1. Close your Xcode project
  2. Re-Open your project with the Xcode workspace file and not with the .xcodeproj
  1. 关闭您的 Xcode 项目
  2. 使用 Xcode 工作区文件而不是 .xcodeproj 重新打开您的项目

This work fine for me !

这对我来说很好用!

回答by Helbert

You just need to change Framework Search Pathsto $(inherited).

您只需要更改Framework Search Paths$(inherited).

P.S: Build Settings -> Search Paths -> Framework Search Paths

PS:构建设置 -> 搜索路径 -> 框架搜索路径

enter image description here

在此处输入图片说明

回答by Nanda Z

I solve my problem with this way (Only if your case are you have imported Alamofire in project but still not found)

我用这种方式解决了我的问题(仅当您在项目中导入了 Alamofire 但仍未找到时)

  1. Close all your project and your XCode
  2. Re-Open your XCode Apps then select bottom text enter image description here
  3. Choose your project, do not select file inside. Just click open on folder project name enter image description here
  1. 关闭所有项目和 XCode
  2. 重新打开您的 XCode 应用程序,然后选择底部文本 在此处输入图片说明
  3. 选择你的项目,不要选择里面的文件。只需单击文件夹项目名称上的打开 在此处输入图片说明

回答by Suraj Sonawane

Use Cocoapodsto integrate Alamofirein your project:

使用CocoapodsAlamofire集成到您的项目中:

To add Alamofire into your project please do the following steps:

要将 Alamofire 添加到您的项目中,请执行以下步骤:

add the below lines into your pod file.

将以下行添加到您的pod 文件中

  source 'https://github.com/CocoaPods/Specs.git'
  platform :ios, '8.0'
  use_frameworks!

  pod 'Alamofire', '~> 2.0'

回答by Tim O'Brien

Not stupid!

不傻!

  • Click the little (easily missed) + button in the bar under General, Build Phases, etc. and in the dropdown click New Copy Files Phase
  • Double click the title and rename it "Copy Frameworks" (optional)
  • Change destination to Frameworks
  • Add Alamofire.framework
  • 单击 General、Build Phases 等下栏中的小(容易错过)+ 按钮,然后在下拉列表中单击New Copy Files Phase
  • 双击标题并将其重命名为“Copy Frameworks”(可选)
  • 将目标更改为框架
  • 添加 Alamofire.framework

Once it's linked it doesn't necessarily exist on your device, this ensures it will.

链接后,它不一定存在于您的设备上,这确保它会存在。

回答by user964502

I was also facing the same issue, and '$(inherited)' was missing in Target -> Build Settings ->Framework Search paths. Giving this fixed my issue.

我也遇到了同样的问题,目标 -> 构建设置 -> 框架搜索路径中缺少 '$(inherited)'。给这个解决了我的问题。

回答by Amir Ardalan

I removed the Alamofirefrom pod file but I got the error again finally I figured out Alamofireexist in Target -> Build setting -> Other Linker Flagsand remove from there and build successfully finally.

Alamofire从 pod 文件中删除了该文件,但我再次遇到错误,最后我发现Alamofire存在Target -> Build setting -> Other Linker Flags并从那里删除并最终成功构建。