xcode Cocoapods - Flurry & TestFlight - 未定义的架构符号

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18132995/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 03:40:48  来源:igfitidea点击:

Cocoapods - Flurry & TestFlight - Undefined symbols for architecture

xcodelinker-errorsflurrytestflightcocoapods

提问by RyanJM

I'm upgrading my project to use Cocoapods and when I try building my project for an iOS device or for a simulator I get:

我正在升级我的项目以使用 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)

(with the architecture different of course)

(当然架构不同)

Under "Link Binary With Libraries" libPods.ais black so I don't think there is any issue there. It is also doing autocomplete for both of them, so I'm not sure why it isn't finding them at the compile time.

在“Link Binary With Libraries”下libPods.a是黑色的,所以我认为那里没有任何问题。它也在为他们两个做自动完成,所以我不确定为什么在编译时没有找到它们。

Any suggestions?

有什么建议?

回答by quaertym

The following worked for me:

以下对我有用:

In the Build Settings, do not override "Other Linker Flags". If it is bold, select it and press backspace, it should be back to its normal state. If it is not fixed, delete all flags, remove and reinstall Pods and that should fix it.

在构建设置中,不要覆盖“其他链接器标志”。如果是粗体,选择它并按退格键,它应该会恢复到正常状态。如果未修复,请删除所有标志,删除并重新安装 Pod,这应该可以修复它。

回答by Tom Redman

Cocoapods, for some reason, doesn't include libTestFlight.ain the TestFlight target. So to fix this issue, each time you run pod install, you must:

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

  1. Open the Pods-TestFlightSDKtarget in the Pods.xcodeprojproject
  2. Open Build Phasestab
  3. Add (via "Add Other...") libTestFlight.ato Link Binary With Librariesdropdown
  1. Pods-TestFlightSDKPods.xcodeproj项目中打开目标
  2. 打开Build Phases标签
  3. 添加(通过“添加其他...”)libTestFlight.aLink Binary With Libraries下拉菜单

libTestFlight.acan be found in your [$SRCROOT]/Pods/TestFlightsSDKfolder.

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

enter image description here

在此处输入图片说明

Do the same with Flurry and you're good to go!

对 Flurry 做同样的事情,你就可以开始了!

Update May 1st 2014

2014 年 5 月 1 日更新

It looks like "missing library integration" is a symptom of using the --no-integrateflag (e.g., pod install --no-integrate).

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

And to make life easier, I've written a script to automatically add the libraries after running pod (update|install) --no-integrate

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

Adjust as necessary and add this to the bottom of your Podfile:

根据需要进行调整并将其添加到您的底部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

回答by HereTrix

I've found that can be few reasons of this issue:

我发现这个问题可能有几个原因:

  1. libPod.a not included in "link binary with libraries" (try to remove reference and add again)
  2. Compiler can't find library. Strange behaviour, try to write path to libraries using ${PODS_ROOT} at "Library search path". ($(PODS_ROOT)/TestFlightSDK for example)
  3. Compiler can't find header. try to write path to headers using ${PODS_ROOT} at "Header search path".
  1. libPod.a 未包含在“与库链接的二进制文件”中(尝试删除引用并重新添加)
  2. 编译器找不到库。奇怪的行为,尝试在“库搜索路径”中使用 ${PODS_ROOT} 写入库路径。(例如,$(PODS_ROOT)/TestFlightSDK)
  3. 编译器找不到头文件。尝试在“标题搜索路径”中使用 ${PODS_ROOT} 写入标题的路径。

Hope that this is helpful.

希望这是有帮助的。