我使用Apple提供的UnitTest模板进行项目设置。我也将MagicalRecord添加到Prefix标题中。当我在设备和模拟器上运行时,一切正常。
除了单元测试之外,当我编译单元测试时,构建失败并使用以下命令:'CoreData+MagicalRecord.h' file not found
。这发生在前缀标题中。
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
有人有想法吗?
答案 0 :(得分:2)
确保为您的测试目标正确设置了Header Search Paths
。
我通常使用CocoaPods来自动化这些东西
答案 1 :(得分:0)
尝试在终端中运行命令(1),然后在步骤(2)中添加导入
run pod update
#import <MagicalRecord/CoreData+MagicalRecord.h>
到任何目标的源文件并开始使用MagicalRecord!