CoreData+MagicalRecord.h file not found

2.6k Views Asked by At

I got stuck into pretty simple looking error but I am not able to solve it.

I am trying to add MagicalRecord into my project with the help of this tutorial, but, after adding #import "CoreData+MagicalRecord.h" in prefix.pch I am getting CoreData+MagicalRecords.h file not found error.

I also tried #import <MagicalRecord/MagicalRecord.h> this but same error.

What can be the issue.

UPDATE:

Adding my prefix file code here.

#ifdef __OBJC__
    #import <UIKit/UIKit.h>
    #import <Foundation/Foundation.h>
    #import "Constants.h"
    #define MR_SHORTHAND
    #import "CoreData+MagicalRecord.h"
#endif
2

There are 2 best solutions below

0
On

This may not be directly related to the original question's problem, but could come in handy.

If you are using Magical Record 2.3 beta 6 or later, it seems from the issues that there was a problem with manual importing that never got sorted out. See https://github.com/magicalpanda/MagicalRecord/issues/1019 (thought the referenced issue claims to have fixed it, I beg to differ)

I was able to get my manual version to build and run by converting my imports from the format #import <MagicalRecord/filename.h> to #import "filename.h".

2
On

I had the same problem before. This sounds ridiculous but move #import <CoreData+MagicalRecord.h> above #import <UIKit/UIKit.h>. Note the use of <> instead of "" if you are using pods.

Edit Please take note that this is an old answer. It worked for me before when I posted it. It may not work anymore... I have not used MagicalRecord for quite some time now.