ios 将应用程序放入 AdMob 后出现“未找到库”错误

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

Error "library not found for" after putting application in AdMob

iosxcodeadmobcocoapods

提问by ViniciusPV

I am getting an error after I put my application in an AdMob. The app was working until today. The error is the following:

将应用程序放入 AdMob 后出现错误。该应用程序一直工作到今天。错误如下:

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

How can I fix this? Thank you.

我怎样才能解决这个问题?谢谢你。

采纳答案by raurora

Sometimes you just remove the reference of the library and add reference again.

有时您只需删除库的引用并再次添加引用。

Apart from adding the Google Mobile Ads SDK and other libraries again from scratch, I would recommend you checking the Library Search Paths. There are instances when you copy or duplicate a target, Xcode decides that it needs to escape any double quotes " with a '\'. Make sure you remove all the \'s - it should look like this -

除了从头开始添加 Google 移动广告 SDK 和其他库之外,我建议您检查库搜索路径。在某些情况下,当您复制或复制目标时,Xcode 决定它需要使用 '\' 转义任何双引号 "。确保删除所有 \'s - 它应该如下所示 -

enter image description here

在此处输入图片说明

I was able to duplicate the error, by doing prefixing my path with multiple '\'.

通过在我的路径前面加上多个“\”,我能够复制错误。

回答by Casper

I had a similar "library not found" issue. However it was because I accidentally was using the .xcodeprojfile instead of the .xcworkspacefile.

我有一个类似的“未找到库”问题。然而这是因为我不小心使用了.xcodeproj文件而不是.xcworkspace文件。

回答by Abuzar Amin

Select your Target, go to "Build Phases"in "Link Binary With Libraries"remove ".a"file of that library. Clean and Build.

选择您的目标,请"Build Phases""Link Binary With Libraries"删除".a"该库的文件。清洁和建造。

回答by hasan

If error related to Cocoapods as follow:

如果与 Cocoapods 相关的错误如下:

library not found for -lPod-...

You need to check Other Linker Flagsand remove it from there.

您需要检查其他链接器标志并将其从那里删除。

Extra Information:If you have an old project that uses cocoapods. And recently you needed to add the use_frameworks!to your podfile. cocoapods will not add the libraries to your Other Linker Flags anymore cause its inherited. Therefore, you may need to remove those manually from the other linker flags which they were added before using the use_frameworks!

额外信息:如果您有一个使用 cocoapods 的旧项目。最近你需要添加use_frameworks!到您的 podfile。cocoapods 不会再将库添加到您的其他链接器标志中,因为它是继承的。因此,您可能需要从使用 use_frameworks 之前添加的其他链接器标志中手动删除它们!

回答by Ted

For my case Xcode 7, also worked in Xcode 9.1

对于我的情况Xcode 7,也适用于Xcode 9.1

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

set Build Active architecture Onlyto Yes

设置Build Active architecture OnlyYes

enter image description here

在此处输入图片说明

回答by ehacinom

This happens if you're using cocoapods, use the .xcworkspacefile instead of the default .xcodeprojfile.

如果您使用 cocoapods 会发生这种情况,请使用该.xcworkspace文件而不是默认.xcodeproj文件。

回答by Teena nath Paul

If error is like following

如果错误如下

ld: library not found for -lpods

ld:找不到 -lpods 的库

I found that a file "libPods.a" which is in red colour(like missing files) was created somehow in the Framework group of the project. I just simply removed that file and everything got fine.

我发现在项目的框架组中以某种方式创建了一个红色的文件“libPods.a”(如丢失的文件)。我只是简单地删除了那个文件,一切都很好。

EDIT: Another Solution

编辑:另一个解决方案

Another Solution that I have already answered in the similar question is in this link

我已经在类似问题中回答的另一个解决方案在此链接中

回答by Hitesh Agarwal

goto Build Phases -> Link Binary With Librariesand remove library which show errors because that library is not available in project folder

转到Build Phases -> Link Binary With Libraries并删除显示错误的库,因为该库在项目文件夹中不可用

回答by kkodev

This can also happen if you open project file instead of a workspace. I've wasted like a day myself this way.

如果您打开项目文件而不是工作区,也会发生这种情况。我自己就这样浪费了一天。

回答by reetu

Late for the answer but here are the list of things which I tried.So it will be in one place if anyone wants to try to fix the issue.

答案迟到了,但这里列出了我尝试过的事情。因此,如果有人想尝试解决问题,它将在一个地方。

  1. Valid architecture = armv7 armv7s
  2. Build Active Architecture only = NO
  3. Target -> Build Settings ->Other Linker Flags = $(inherited)
  4. Target -> Build Settings ->Library Search Path = $(inherited)
  5. Product Clean
  6. Pod Update in terminal
  1. 有效架构 = armv7 armv7s
  2. 仅构建主动架构 = 否
  3. Target -> Build Settings -> Other Linker Flags = $(inherited)
  4. 目标 -> 构建设置 -> 库搜索路径 = $(继承)
  5. 产品清洁
  6. 终端中的 Pod 更新