xcode Cocoapods 错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)

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

Cocoapods error: linker command failed with exit code 1 (use -v to see invocation)

xcodecocoaswift2

提问by ItsPronounced

First time using cocoa pods (latest version) for dependencies in the latest Xcode 7.2.1 with Swift 2.1. I initialize my project folder and then edit the podfile and add my dependencies. When I run pod installit runs without a hitch until I open my project and try to build. I've tried this with two separate projects (one being brand new for testing) and I get linker command failed with exit code 1 (use -v to see invocation)for both. My pod file looks like this:

第一次在最新的 Xcode 7.2.1 和 Swift 2.1 中使用可可豆荚(最新版本)作为依赖项。我初始化我的项目文件夹,然后编辑 podfile 并添加我的依赖项。当我运行pod install它时,它会顺利运行,直到我打开我的项目并尝试构建。我已经在两个单独的项目中尝试过这个(一个是全新的用于测试),我得到linker command failed with exit code 1 (use -v to see invocation)了两个。我的 pod 文件如下所示:

platform :ios, '8.0' #8.0 is minimum supported, right?
use_frameworks!

target 'Testing Frameworks' do
    pod 'Alamofire', '~> 3.0'
end

回答by Dx_

Close your current project and open the .xcworkspace created in your project folder.

关闭当前项目并打开在项目文件夹中创建的 .xcworkspace。

Good luck!

祝你好运!

回答by Jakub Truhlá?

First try to Show the Report navigator(8. tab in left navigator of Xcode)and check the report. It should give you some info what is going on like:

首先尝试显示报告导航器(Xcode 左侧导航器中的 8. 选项卡)并检查报告。它应该为您提供一些信息,例如:

framework not found Pods_[PODFILE_OLD_ABSTRACT_TARGET_NAME].

framework not found Pods_[PODFILE_OLD_ABSTRACT_TARGET_NAME].

Often when you change the abstract_target's name (or whatever the Cocoapods is using to name the framework in the future)in podfile, check your target's Link binary With librariesunder the Build phases.

通常,当您在 中更改abstract_target的名称(或 Cocoapods 将来用于命名框架的任何名称)podfile,请在Build 阶段下检查目标的Link binary With libraries

If it keeps the framework with the old name that no longer exists (next to the new one), remove it.

如果它保留旧名称的框架不再存在(在新名称旁边)则将其删除

回答by Rachit Rawat

  1. Go to Project Settings.
  2. Go to Build Settings.
  3. Change BUILD ACTIVE ARCHITECTURE ONLY to NO.
  1. 转到项目设置。
  2. 转到构建设置。
  3. 将 BUILD ACTIVE ARCHITECTURE ONLY 改为 NO。

回答by Bastek

I just had similar problem in my project. I found that in GENERAL settings of the project in section "Linked Frameworks and Libraries" there are two files for pods: "libPods.a"and "Pods_ProjectName.framework"

我刚刚在我的项目中遇到了类似的问题。我发现在“链接框架和库”部分的项目的一般设置中,有两个用于 pod 的文件:"libPods.a""Pods_ProjectName.framework

Deleting "libPods.a"helped in my case.

删除"libPods.a"对我有帮助。

Linked Frameworks and Libraries

链接的框架和库

回答by ostap_holub

Solution for me was adding `$(inherited) flag to LIBRARY_SEARCH_PATHS in target build settings.

我的解决方案是在目标构建设置中将 `$(inherited) 标志添加到 LIBRARY_SEARCH_PATHS。

回答by connorbode

If you encounter this error while developing a pod, it's possible that your module doesn't export anything. Check the pattern for s.source_filesin your .podspec. For me, the glob pattern was missing my source files.

如果您在开发 pod 时遇到此错误,则您的模块可能没有导出任何内容。检查s.source_files您的.podspec. 对我来说,glob 模式缺少我的源文件。