ios Cocoapods ld:找不到 -lPods-Projectname 的库

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

Cocoapods ld: library not found for -lPods-Projectname

iosobjective-ccocoapods

提问by Eugene Biryukov

I've installed cocoa pods library and some frameworks through it. Now when I compile project the build fails.

我已经通过它安装了可可豆荚库和一些框架。现在,当我编译项目时,构建失败。

Error: ld: library not found for -lPods-Project clang: error: linker command failed with exit code 1 (use -v to see invocation)

错误:ld:找不到 -lPods-Project clang 的库:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)

Here part of text:

这里部分文字:

Ld /Users/polzovatel/Library/Developer/Xcode/DerivedData/Project-bybevfqrgvqqldbzsgewqafpmylj/Build/Products/Debug-iphonesimulator/Project app/Project normal i386
    cd /Users/polzovatel/Projects/iOS-master/Project_iPhone
    export IPHONEOS_DEPLOYMENT_TARGET=6.0
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"

What I need to do to fix this problem?

我需要做什么来解决这个问题?

回答by Eugene Biryukov

Fixed it by deleting the -lPods-Projectname.ain Link Binary(for newer versions, delete the -lPods-Projectname.aunder the Frameworksgroup).

通过删除固定它-lPods-Projectname.a链接二进制(较新的版本,删除-lPods-Projectname.a了下框架组)。

回答by Ramis

Whenever I execute "pod install" it leads me to spend several hours of fixing something related with it. So, I deleted CocoaPods stuff and do not have problems any more! Now I am lucky and happy man.

每当我执行“pod install”时,它都会让我花费几个小时来修复与之相关的问题。所以,我删除了 CocoaPods 的东西,不再有问题了!现在我是幸运和快乐的人。

回答by aybars

You can try "Build Active Architecture Only" = YES . it may be solving problem.

您可以尝试 "Build Active Architecture Only" = YES 。它可能正在解决问题。

回答by mcatach

The exact location that you should remove your libs is at:

您应该删除库的确切位置是:

  • Remove -lyourlibname.a in "Link Binary With Libraries" on "Build Phases" of your target.
  • 删除目标的“构建阶段”上的“链接二进制与库”中的 -lyourlibname.a。

回答by skywinder

Ensure that Build Active Architectures Onlysettings for both of your project and the Podsproject were equal for debug and release configuration! That's was a problem in my case.

确保Build Active Architectures Only您的项目和Pods项目的设置对于调试和发布配置是相同的!这对我来说是个问题。

回答by jiexishede

Make sure Build Active Architectures Onlyin your Project/Target and in your Pod/Target and Pod are the same. We often set the debug yes and set the release no.

确保Build Active Architectures Only在您的项目/目标和您的 Pod/目标和 Pod 中是相同的。 我们经常设置 debug yes 和设置 release no。

回答by Michelle

I realized the xcproject file was opened instead of the updated workspace. This fixed my error. Hope this information will help others too.

我意识到 xcproject 文件被打开而不是更新的工作区。这修复了我的错误。希望这些信息也能帮助其他人。

回答by HotFudgeSunday

If none of the other answers help you, try this:

如果其他答案都没有帮助您,请尝试以下操作:

  • Deintegrate cocoa pods using pod deintegrate. Check this link https://github.com/kylef/cocoapods-deintegrate.
  • Search on the build settings for target and project file for "pod". Anything that looks like it belonged to cocoa pods, remove.
  • Finally, run pod installonce again.
  • 使用pod deintegrate. 检查此链接https://github.com/kylef/cocoapods-deintegrate
  • 搜索“pod”的目标和项目文件的构建设置。任何看起来像是属于可可豆的东西,请移除。
  • 最后,pod install再次运行。

回答by MNassar

I had a very different experience. I tried removed the library from build settings to no avail. And honestly, I couldn't see the logic behind it.

我有一个非常不同的经历。我尝试从构建设置中删除库无济于事。老实说,我看不出它背后的逻辑。

What I did was try a new pod install. And so it gave me this error

我所做的是尝试一个新的pod install. 所以它给了我这个错误

[!] The ProjectName [Debug] target overrides the LIBRARY_SEARCH_PATHS build setting defined in Pods/Target Support Files/Pods-/Pods-.debug.xcconfig. This can lead to problems with the CocoaPods installation - Use the $(inherited)flag, or - Remove the build settings from the target.

[!] The ProjectName [Release] target overrides the LIBRARY_SEARCH_PATHS build setting defined in Pods/Target Support Files/Pods-/Pods-.debug.xcconfig. This can lead to problems with the CocoaPods installation - Use the $(inherited)flag, or - Remove the build settings from the target.

[!] ProjectName [Debug] 目标会覆盖 Pods/Target Support Files/Pods-/Pods-.debug.xcconfig 中定义的 LIBRARY_SEARCH_PATHS 构建设置。这可能会导致 CocoaPods 安装出现问题 - 使用该$(inherited)标志,或者 - 从目标中删除构建设置。

[!] ProjectName [Release] 目标会覆盖 Pods/Target Support Files/Pods-/Pods-.debug.xcconfig 中定义的 LIBRARY_SEARCH_PATHS 构建设置。这可能会导致 CocoaPods 安装出现问题 - 使用该$(inherited)标志,或者 - 从目标中删除构建设置。

So I did what it told me to, I added the $(inherited)flag to build settings. And all worked well

所以我做了它告诉我的事情,我添加了$(inherited)标志来构建设置。一切顺利

回答by Elad

Go to Product > Scheme > Edit Scheme... > Build > + > Add the Pods-Projectname.a and drag it to the top > Clean & Build your project.

转到 Product > Scheme > Edit Scheme... > Build > + > 添加 Pods-Projectname.a 并将其拖到顶部 > Clean & Build your project。