ios Xcode 7 构建失败:ld:找不到 -lGoogleAnalyticsServices 的库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33220272/
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
Xcode 7 build failed: ld: library not found for -lGoogleAnalyticsServices
提问by SDW
Every time when I open my app with Xcode I get this error:
每次当我用 Xcode 打开我的应用程序时,我都会收到这个错误:
ld: library not found for -lGoogleAnalyticsServices
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Then I need to unmark the target on the libGoogleAnalyticsServices.a
file and mark it on again. After the uncheck/check of the target the app runs normally...
然后我需要取消标记libGoogleAnalyticsServices.a
文件上的目标并再次标记它。取消选中/选中目标后,应用程序正常运行...
I get 2 other warning when this happens:
发生这种情况时,我会收到另外 2 个警告:
ld: warning: directory not found for option '-L/Users/vision/Documents/Apps/Mijn Cijfers/Mijn'
ld: warning: directory not found for option '-LCijfers'
Now this looks like Xcode can't read spaces and looks for a new directory called Cijfers. My app is called: Mijn Cijfers, but I never had this problem before with spaces in my project name.
现在看起来 Xcode 无法读取空格并查找名为 Cijfers 的新目录。我的应用程序名为:Mijn Cijfers,但我以前从未遇到过这个问题,因为我的项目名称中有空格。
Every time when I check/uncheck the target of libGoogleAnalyticsServices.a
the Library Search Path is adding new rows:
每次我选中/取消选中libGoogleAnalyticsServices.a
库搜索路径的目标时都会添加新行:
I think both cases has to do something with the warnings and errors that I get. It's really annoying to remove the Library Search Paths and check/uncheck the target to let my app run normally. -.-
我认为这两种情况都必须对我收到的警告和错误做些什么。删除库搜索路径并选中/取消选中目标以使我的应用程序正常运行真的很烦人。-.-
Does anyone know a solution to solve this odd bug?
有谁知道解决这个奇怪错误的解决方案?
回答by Meenakshi
You need to delete all these path except the "$inherited" and then add Google Analytics library path (Drag the folder where you saved the library).
您需要删除除“$inherited”之外的所有这些路径,然后添加 Google Analytics 库路径(拖动您保存库的文件夹)。
If you follow this then you don't need to recheck/uncheck the library path.
如果您按照此操作,则无需重新选中/取消选中库路径。
回答by karan
If you have just created pod file by running $ pod init
command in terminal,
如果您刚刚通过pod init
在终端中运行 $命令创建了 pod 文件,
- then just close project and Open
projectName.xcworkspace
instead ofprojectName.xcodeproj
- 然后只需关闭项目并打开
projectName.xcworkspace
而不是projectName.xcodeproj
which will not throw error -lxyzLibray eg. -lJSONModel not found.
这不会抛出错误 -lxyzLibray 例如。-lJSONModel 未找到。
Now compile and debug again It will work.
现在再次编译调试就可以了。