Cocoapods - Flurry&TestFlight - 未定义的建筑符号

Rya*_*nJM 20 xcode linker-errors flurry testflight cocoapods

我正在升级我的项目以使用Cocoapods,当我尝试为iOS设备或模拟器构建项目时,我得到:

Undefined symbols for architecture armv7:
  "_OBJC_CLASS_$_TestFlight", referenced from:
      objc-class-ref in PhotoPreviewViewController.o
  "_OBJC_CLASS_$_Flurry", referenced from:
      objc-class-ref in MyAppDelegate.o
      objc-class-ref in InitialSetupViewController.o
      objc-class-ref in InitialDownloadViewController.o
      objc-class-ref in HistoryViewController.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Run Code Online (Sandbox Code Playgroud)

(当然,架构不同)

在"Link Binary With Libraries"下libPods.a是黑色的,所以我认为那里没有任何问题.它也正在对它们进行自动完成,所以我不确定为什么它在编译时没有找到它们.

有什么建议?

qua*_*tym 70

以下对我有用:

在构建设置中,不要覆盖"其他链接器标志".如果是粗体,选择它并按退格键,它应该恢复到正常状态.如果它没有修复,删除所有标志,删除并重新安装Pods,这应该修复它.

  • 就是这个!非常感谢SOOOO !! (4认同)
  • 这很有效.从来不知道你可以按退格去除覆盖.起初我刚刚删除了那里的"-ObjC"而且它是空白的.显然"空白"并不意味着"默认" (4认同)
  • 一定要检查"库搜索路径"构建设置.这对我来说是个问题. (2认同)

Tom*_*man 22

由于某些原因,libTestFlight.aCocoapods 不包含在TestFlight目标中.因此,要解决此问题,每次运行时pod install,您必须:

  1. Pods-TestFlightSDKPods.xcodeproj项目中打开目标
  2. 打开Build Phases标签页
  3. 添加(通过"添加其他...")libTestFlight.aLink Binary With Libraries下拉列表

libTestFlight.a可以在您的[$SRCROOT]/Pods/TestFlightsSDK文件夹中找到.

在此输入图像描述

用Flurry做同样的事情,你很高兴去!

2014年5月1日更新

看起来"缺少库集成"是使用--no-integrate标志的症状(例如,pod install --no-integrate).

为了让生活更轻松,我编写了一个脚本,可以在运行后自动添加库 pod (update|install) --no-integrate

根据需要进行调整,并将其添加到您的底部Podfile:

# Use post_install to automatically include required libraries
post_install do |installer_representation|
    installer_representation.project.targets.each do |target|
        if target.name == 'Pods-TestFlightSDK'
            libFile = installer_representation.project.new_file('TestFlightSDK/libTestFlight.a')
        end

        if target.name == 'Pods-Brightcove-Player-SDK'
            libFile = installer_representation.project.new_file('Brightcove-Player-SDK/Library/libBCOVPlayerSDK.a')
        end

        unless libFile.nil?
            puts "    - Adding %s to %s Frameworks Build Phases" % [libFile, target.name]
            target.frameworks_build_phase.add_file_reference(libFile)
        end
    end
end
Run Code Online (Sandbox Code Playgroud)