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
Cocoapods - Flurry & TestFlight - Undefined symbols for architecture
提问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.a
is 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.a
in the TestFlight target. So to fix this issue, each time you run pod install
, you must:
由于某种原因,libTestFlight.a
Cocoapods没有包含在 TestFlight 目标中。因此,要解决此问题,每次运行时pod install
,您必须:
- Open the
Pods-TestFlightSDK
target in thePods.xcodeproj
project - Open
Build Phases
tab - Add (via "Add Other...")
libTestFlight.a
toLink Binary With Libraries
dropdown
Pods-TestFlightSDK
在Pods.xcodeproj
项目中打开目标- 打开
Build Phases
标签 - 添加(通过“添加其他...”)
libTestFlight.a
到Link Binary With Libraries
下拉菜单
libTestFlight.a
can be found in your [$SRCROOT]/Pods/TestFlightsSDK
folder.
libTestFlight.a
可以在您的[$SRCROOT]/Pods/TestFlightsSDK
文件夹中找到。
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-integrate
flag (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:
我发现这个问题可能有几个原因:
- libPod.a not included in "link binary with libraries" (try to remove reference and add again)
- 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)
- Compiler can't find header. try to write path to headers using ${PODS_ROOT} at "Header search path".
- libPod.a 未包含在“与库链接的二进制文件”中(尝试删除引用并重新添加)
- 编译器找不到库。奇怪的行为,尝试在“库搜索路径”中使用 ${PODS_ROOT} 写入库路径。(例如,$(PODS_ROOT)/TestFlightSDK)
- 编译器找不到头文件。尝试在“标题搜索路径”中使用 ${PODS_ROOT} 写入标题的路径。
Hope that this is helpful.
希望这是有帮助的。