运行 Google 分析项目使用 Pods 时出现 Apple Mach-O 链接器错误

Apple Mach-O Linker Error while running the Google Analytics project using Pods

我是一名初级程序员,在使用 cocoa pods.

时遇到了 Google 分析库的问题

我已经正确安装了 cocoa pods,安装了 pod 文件 与它里面的依赖关系。即使我可以在单独的文件夹“Pods”中看到 finder 中的生成文件,也 GoogleAnalytics1.xcworkspace 但仅供参考

  1. GoogleAnalytics1 是我的项目名称。

  2. GoogleAnalytics1.xcworkspace(在 pod 文件安装期间创建)和 GoogleAnalytics.xcodeproject 位于名为 "GoogleAnalytics1" 的同一文件夹中。

任何形式的帮助都会提前appreciated.Thanks。

Ld /Users/rajesh/Library/Developer/Xcode/DerivedData/GoogleAnalytics1-gklncgocdpccldgqeibewkakesqh/Build/Products/Debug-iphonesimulator/GoogleAnalytics1.app/GoogleAnalytics1 normal i386
cd /Users/rajesh/Documents/Mangesh/BBI/Project/US/NewTableView16/GoogleAnalytics1
export IPHONEOS_DEPLOYMENT_TARGET=8.1
export PATH="/Applications/Xcode 2.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode 2.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode\ 2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode\ 2.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk -     
L/Users/rajesh/Library/Developer/Xcode/DerivedData/GoogleAnalytics1-    gklncgocdpccldgqeibewkakesqh/Build/Products/Debug-iphonesimulator -    L/Users/rajesh/Documents/Mangesh/BBI/Project/US/NewTableView16/GoogleAnalytics1/Pods/Google/Libraries -
L/Users/rajesh/Documents/Mangesh/BBI/Project/US/NewTableView16/GoogleAnalytics1/Pods/GoogleAnalytics/Libraries -
L/Users/rajesh/Documents/Mangesh/BBI/Project/US/NewTableView16/GoogleAnalytics1/Pods/GoogleNetworkingUtilities/Libraries -
L/Users/rajesh/Documents/Mangesh/BBI/Project/US/NewTableView16/GoogleAnalytics1/Pods/GoogleSymbolUtilities/Libraries -
L/Users/rajesh/Documents/Mangesh/BBI/Project/US/NewTableView16/GoogleAnalytics1/Pods/GoogleUtilities/Libraries -
F/Users/rajesh/Library/Developer/Xcode/DerivedData/GoogleAnalytics1-gklncgocdpccldgqeibewkakesqh/Build/Products/Debug-iphonesimulator -filelist   /Users/rajesh/Library/Developer/Xcode/DerivedData/GoogleAnalytics1-  
gklncgocdpccldgqeibewkakesqh/Build/Intermediates/GoogleAnalytics1.build/Debug-iphonesimulator/GoogleAnalytics1.build/Objects-normal/i386/GoogleAnalytics1.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -objc_abi_version -Xlinker 2 -ObjC -lGGLAnalytics -lGGLCore -lGSDK_Overload -lGTMSessionFetcher_core -lGTMSessionFetcher_full -lGTMStackTrace -lGTM_AddressBook -lGTM_DebugUtils -lGTM_GTMURLBuilder -lGTM_KVO -lGTM_NSDictionary+URLArguments -lGTM_NSScannerJSON -lGTM_NSStringHTML -lGTM_NSStringXML -lGTM_Regex -lGTM_RoundedRectPath -lGTM_StringEncoding -lGTM_SystemVersion -lGTM_UIFont+LineHeight -lGTM_core -lGTM_iPhone -lGoogleAnalytics -lsqlite3 -lz -framework AddressBook -framework CoreData -framework SystemConfiguration -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=8.1 -lPods-GoogleAnalytics1 -Xlinker -dependency_info -Xlinker /Users/rajesh/Library/Developer/Xcode/DerivedData/GoogleAnalytics1-gklncgocdpccldgqeibewkakesqh/Build/Intermediates/GoogleAnalytics1.build/Debug-iphonesimulator/GoogleAnalytics1.build/Objects-normal/i386/GoogleAnalytics1_dependency_info.dat -o /Users/rajesh/Library/Developer/Xcode/DerivedData/GoogleAnalytics1-gklncgocdpccldgqeibewkakesqh/Build/Products/Debug-iphonesimulator/GoogleAnalytics1.app/GoogleAnalytics1

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

如评论中所述,您需要打开 .xcworkspace 文件才能在 pods 处理项目后打开该项目。

我遇到的另一个问题 - XCode 7(目前仍处于 Beta 阶段,但很快就会正常发布)也会对 cocoapods 产生这些问题。因此,如果您现在尝试使用 Swift 2,cocoapods 无法在项目中运行,并且您会遇到与您所看到的类似的错误。由于这个问题,我不得不在当前 Swift 2 个项目上卸载 cocoapods,我目前正在寻找其他选项 - Carthage 看起来是目前最好的选项。 https://github.com/Carthage/Carthage