Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error importing "NSManagedObject.h" in XCode4/LLVM2.0 #42

Closed
nomothetis opened this issue Dec 17, 2010 · 10 comments
Closed

Error importing "NSManagedObject.h" in XCode4/LLVM2.0 #42

nomothetis opened this issue Dec 17, 2010 · 10 comments

Comments

@nomothetis
Copy link

When I run mogenerator via the command line, the generated files have the following import statements:

#import <CoreData/CoreData.h>
#import "NSManagedObject.h"

These files can't compile, and, from looking at the template, it seems that mogenerator thinks NSManagedObject.h is the custom base class, which obviously isn't the case. Any idea if I'm doing something wrong? This is the complete command-line call I'm using:

mogenerator -m MyAppDataModel.xcdatamodel -M Classes/Generated/ -H Classes/

For reference, I am using XCode 4 Preview 5, with the Clang compiler that ships with it (LLVM 2.0).

Thanks!

@rentzsch
Copy link
Owner

huh, I don't know this issue here. Still a problem with Xcode 4 GM seed? If so, can you post your model file?

@nomothetis
Copy link
Author

Yes, the problem is still there. It's kind of weird. Also, the inheritance isn't respected by the generator (unless I need to specify a flag of some kind). Where can I post the data model?

@rentzsch
Copy link
Owner

Get Dropbox and post a public url?

@bengottlieb
Copy link

I'm seeing this with Mogen v1.26 and Xcode 4.4. Seems to be related to using abstract base classes.

@rentzsch
Copy link
Owner

rentzsch commented Sep 2, 2012

@bengottlieb hmm, master's new test/ directory contains a model file with an abstract bas class (HumanMO) and it generates & compiles & runs sans issues. Can you repro the issue there? cd mogenerator/test && rake will do all the work of compiling new local mogenerator and running the tests.

@bengottlieb
Copy link

I think I found the problem. If you explicitly pass in a base class, then it will #include it, even if it's NSManagedObject.

@agmathew
Copy link

agmathew commented Jan 1, 2013

I ran into this issue due to a bug in Xcode. I was trying to generate code from several models that inherited from an abstract base entity. It turns out that although the Xcode model editor showed that the inheritance was setup correctly, the model file was actually corrupted in some way. You can see if this is the case by using Xcode's built-in generator and seeing the code that it generates. In my case, the generated code wasn't inheriting properly from the abstract base class.

I fixed this issue by manually going through each model, resetting the inheritance, and then saving the file. I was then able to get mogenerator to work again. Hope that helps someone.

@rentzsch
Copy link
Owner

rentzsch commented Jan 1, 2013

@agmathew thanks for the followup!

@lukeredpath
Copy link

I'm still seeing this issue - I have two entities that inherit from an abstract entity. The concrete entities have custom classes, the abstract entity does not.

I suppose I could generate a custom class for my abstract entity but I'm not sure why I should need to. Any ideas?

ddrccw pushed a commit to ddrccw/mogenerator that referenced this issue Jan 20, 2014
@oks
Copy link

oks commented Jun 21, 2014

I again got this issue, but I was able to fix it by myself, when you create even abstract entity, or for inheritance, for properly work you MUST specify class field. http://take.ms/WFevx
I hope it will help somebody.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants