Unit Test build failing when importing MagicalRecord

安稳与你 提交于 2019-12-11 03:46:38

问题


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)

  1. In your project directory

run pod update

  1. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!