Cocoapods: Test target linker error with use of @testable

Created on 14 Oct 2015  路  3Comments  路  Source: CocoaPods/CocoaPods

I'm getting the following error when building my test target:
ld: framework not found Fabric for architecture x86_64

Here's a simplified version of my Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'

use_frameworks!
inhibit_all_warnings!

pod 'AFNetworking'
pod 'AWSCore'
pod 'AWSS3'
pod 'Bolts'
pod 'Crashlytics'
pod 'Fabric'
pod 'Firebase'

target 'MyProjectTests', :exclusive => true do
  pod 'FBSnapshotTestCase'
end

This happens when I have a test case that imports my main target's module

@testable import MyProject

class MyTestCase: XCTestCase {
    func testSomething() {
        XCTAssertTrue(true)
    }
}

I can resolve this by either:

Adding pod 'Fabric' to the test target in the pod file:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'

use_frameworks!
inhibit_all_warnings!

pod 'AFNetworking'
pod 'AWSCore'
pod 'AWSS3'
pod 'Bolts'
pod 'Crashlytics'
pod 'Fabric'
pod 'Firebase'

target 'MyProjectTests', :exclusive => true do
  pod 'Fabric'
  pod 'FBSnapshotTestCase'
end

or by adding the following manually to MyProjectTests.debug.xcconfig:

FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Fabric"

I've noticed that all of my other pod can be @import'ed in my test case, except for Crashlytics and Fabric.

I'm using the latest version of Cocoapods 0.39 and the latest Fabric / Crashlytics versions.

Is this a podspec issue?

Most helpful comment

I am having this issue right now. Double checked my bridging header, no left-overs there. Using 1.0.0.beta4 version of CocoaPods and I have no pods whatsoever for test target, so my unit tests target has no Pods-generated xcconfig associated.

As soon as I add this line to unit tests: @testable import MyApp I get link errors.

All 3 comments

Very interesting... Have a project we can download to debug? Thanks!

I had the following in my bridging header - left over from when we manually managed the Fabric / Crashlytics dependencies:

#import <Crashlytics/Crashlytics.h>
#import <Fabric/Fabric.h>

Removing it resolved the issue.

I am having this issue right now. Double checked my bridging header, no left-overs there. Using 1.0.0.beta4 version of CocoaPods and I have no pods whatsoever for test target, so my unit tests target has no Pods-generated xcconfig associated.

As soon as I add this line to unit tests: @testable import MyApp I get link errors.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

5SMNOONMS5 picture 5SMNOONMS5  路  3Comments

lzwjava picture lzwjava  路  3Comments

pallaviMN picture pallaviMN  路  3Comments

pronebird picture pronebird  路  3Comments

Mingmingmew picture Mingmingmew  路  3Comments