我有一个使用 Apple 提供的 UnitTest 模板的项目设置。我也将 MagicalRecord 添加到 Prefix header 中。当我在设备和模拟器上运行时,一切正常。
除了单元测试之外,当我编译单元测试时,构建失败并显示以下命令: 'CoreData+MagicalRecord.h' file not find
。这发生在前缀 header 中。
前缀.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
有人有想法吗?
最佳答案
确保为您的测试目标正确设置 header 搜索路径
。
我一般用CocoaPods这将为你自动化这些东西
关于objective-c - 导入 MagicalRecord 时单元测试构建失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16008956/