Skip to content

Import problem with sub entity #167

talesp opened this Issue Aug 1, 2013 · 6 comments

4 participants

talesp commented Aug 1, 2013

I have an entity FeedItem with a sub entity Style. In Core Data modeler I have the class set equals the name of the entity, in order to generate de machine/human files for both parent (FeedItem) and child (Style) entities.

But on the machine file for Style, I have

@interface _Style : FeedItem {}

As FeedItem.h is not imported anywhere for Style.h (of _Style.h), I get the following error:

Cannot find interface declaration for 'FeedItem', superclass of '_Style'

How should I fix this? The only thing that I can think is include manually on _Style.h, but as I have mogenerator as a pre-build phase, I would loose it.

rentzsch commented Aug 1, 2013

I don't know what you mean by "subentity".

Please have a look at mogenerator's test folder -- it features complex uses cases and is known to work.

talesp commented Aug 1, 2013

Sorry, I'm a little bit new with Core Data, and don't know the terms. What I mean is that I have FeedItem set as Parent Entity of Style. Maybe I should have said child entity?

I'll look at the folder

talesp commented Aug 1, 2013

Looking at the test dir, what I'm trying to do is the same as ParentMO and HumanMO. But in my case, I just named both the same as the entity name. But on the generated code for test dir, _ParentMO.h has the #import "HumanMO.h", and in my case, _Style.h should import FeedItem.h.

Is maybe because I set the class name equals entity name?

It may be important to say: I'm using this with the StackMob SDK. Ultimately, all my entities are children of SMUserManagedObject, a class of StackMob SDK, and included with the pre-build script:

/usr/local/bin/mogenerator --base-class SMUserManagedObject --base-class-import "<StackMob.h>" --template-var arc=true -m ${PROJECT_NAME}.xcdatamodeld/${PROJECT_NAME}.xcdatamodel -M CoreData/Machine -H CoreData/Human

screen shot 2013-08-01 at 19 44 29

Could this be causing my problem? There seems not to be the case, since on test dir all classes include MyBaseClass

heardrwt commented Aug 6, 2013

I believe the problem arises when you have an Entity that specifies a Parent Entity and you are running mogenerator with both --base-class "SPManagedObject" and --base-class-import "<Simperium/SPManagedObject.h>".

Basically, all generated files end up importing #import <Simperium/SPManagedObject.h> which is incorrect for Entities that have a custom Parent Entity specified. (They should instead import their parents .h)

rentzsch commented Aug 6, 2013

@heardrwt NIce detective work. Can you get it repro the problem in mogenerator's tests?

justin commented Mar 22, 2016

We are declaring pull request and issue 0 now that 1.3 is out. If this is still an issue you'd like to see address with 1.30 and going forward, please open a new issue so we can start a fresh discussion. Thank you!

@justin justin closed this Mar 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.