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:
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.
Any suggestions?
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.
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:
Pods-TestFlightSDK
target in the Pods.xcodeproj
projectBuild Phases
tablibTestFlight.a
to Link Binary With Libraries
dropdownlibTestFlight.a
can be found in your [$SRCROOT]/Pods/TestFlightsSDK
folder.
Do the same with Flurry and you're good to go!
Update May 1st 2014
It looks like "missing library integration" is a symptom of using the --no-integrate
flag (e.g., 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
Adjust as necessary and add this to the bottom of your 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
I've found that can be few reasons of this issue:
Hope that this is helpful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With