问题
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?
回答1:
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
回答2:
Try to run command (1) in terminal, then add import in step (2)
- In your project directory
run pod update
- You should now be able to add
#import <MagicalRecord/CoreData+MagicalRecord.h>
to any of your target's source files and begin using MagicalRecord!
来源:https://stackoverflow.com/questions/16008956/unit-test-build-failing-when-importing-magicalrecord