Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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:

  1. Open the Pods-TestFlightSDK target in the Pods.xcodeproj project
  2. Open Build Phases tab
  3. Add (via "Add Other...") libTestFlight.a to Link Binary With Libraries dropdown

libTestFlight.a can be found in your [$SRCROOT]/Pods/TestFlightsSDK folder.

enter image description here

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:

  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".

Hope that this is helpful.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top