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
Error "library not found for" after putting application in AdMob
提问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 - 它应该如下所示 -
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 .xcodeproj
file instead of the .xcworkspace
file.
我有一个类似的“未找到库”问题。然而这是因为我不小心使用了.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
回答by ehacinom
This happens if you're using cocoapods, use the .xcworkspace
file instead of the default .xcodeproj
file.
如果您使用 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.
答案迟到了,但这里列出了我尝试过的事情。因此,如果有人想尝试解决问题,它将在一个地方。
- Valid architecture = armv7 armv7s
- Build Active Architecture only = NO
- Target -> Build Settings ->Other Linker Flags = $(inherited)
- Target -> Build Settings ->Library Search Path = $(inherited)
- Product Clean
- Pod Update in terminal
- 有效架构 = armv7 armv7s
- 仅构建主动架构 = 否
- Target -> Build Settings -> Other Linker Flags = $(inherited)
- 目标 -> 构建设置 -> 库搜索路径 = $(继承)
- 产品清洁
- 终端中的 Pod 更新