【问题标题】:Apple Mach-O Linker Error while running the Google Analytics project using Pods使用 Pod 运行 Google Analytics 项目时出现 Apple Mach-O 链接器错误
【发布时间】:2015-09-04 09:46:49
【问题描述】:

我是一名初级程序员,在使用可可豆荚时遇到了谷歌分析库的问题。

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

  1. GoogleAnalytics1 是我的项目名称。

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

我们将不胜感激。提前致谢。

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)

【问题讨论】:

  • 在Build Settings下的Project Settings中搜索Library Search Path选项,看看上面提到的路径是否正确。
  • 你在使用哪一个。 xcodeproject 或 . xcworkspace ???
  • 首先,我创建了项目,即 GoogleAnalytics1.xcodeproject 和尊敬的 viewControllers、appDelegate、Stroyboard 等,然后当我在终端上使用 pod install 安装 pod 文件时,我得到了 GoogleAnalytics1.xcworkspace使用包含谷歌分析库的 Pods 文件夹自动生成
  • 确保您正在打开“GoogleAnalytics1.xcworkspace”,因为在安装 pod 后,它将运行您的应用程序(代码)的工作区文件。
  • 感谢@MuhammadAwais 它刚刚工作。

标签: ios objective-c google-analytics cocoapods xcode-workspace


【解决方案1】:

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-05-15
    • 1970-01-01
    • 2014-11-18
    • 2014-04-06
    • 2023-03-30
    • 1970-01-01
    相关资源
    最近更新 更多