Search code examples
iosxcodeunit-testingcocoapodsplcrashreporter

COCOAPOD file not found for Xcode unit tests only


I have added PLCrashReporter using POD

use_frameworks! 
pod 'PLCrashReporter'

I have imported following files in Briding Header to use in my swift project

#import <CrashReporter/CrashReporter.h>
#import <CrashReporter/PLCrashReport.h>

If I run the project, then I don't get any problem and it works as expected

If I do xcode unit-test I get the following error (Xcode->Product->Test)

enter image description here


Solution

  • Add the pods separately for Target and TargetTests

    Make the following changes in POD file

    target ‘Target’ do
    platform :ios, ‘8.0’
    use_frameworks!
    pod 'PLCrashReporter'
    end
    
    target 'TargetTests' do
        platform :ios, ‘8.0’
        use_frameworks!
        pod 'PLCrashReporter'
    end
    

    Go to the Build Settings of TargetTests and set the value for “Other Linker Flags” as $(inherited)

    Do a POD install then do Clean Build Folder and run