Search code examples
objective-cxcodeunit-testingmagicalrecordcocoapods

Unit Test build failing when importing MagicalRecord


I have a project setup using the UnitTest template provided by Apple. Too I added MagicalRecord to Prefix header. When I am running on the device and Simulator everything is working fine. Except the Unit Tests, when I am compiling for the unit tests the build failed with the following command: 'CoreData+MagicalRecord.h' file not found . This happens in the prefix header.

prefix.pch

//
// Prefix header for all source files of the '123tv' target in the '123tv' project
//

#import <Availability.h>

#ifndef __IPHONE_3_0
#warning "This project uses features only available in iOS SDK 3.0 and later."
#endif

#ifdef __OBJC__
    #import <UIKit/UIKit.h>
    #import <Foundation/Foundation.h>
    #import "Environments.h"
    #import "CoreData+MagicalRecord.h"    
    #import "PBLog.h"
#endif

Has anyone an idea?


Solution

  • Make sure that the Header Search Paths is set up correctly for your test target.

    I generally use CocoaPods which will automate this stuff for you