xcodecore-datamogenerator

Mogenerator "--base-class-import" not including #import


I am trying to import a file in all of my Mogenerator generated classes using --base-class-import

Here is the Run script:

 mogenerator -m Project/Data/Model/model.xcdatamodeld -O Project/Data/Managed\ Object --template-var arc=true --base-class-import "Project/Categories/NSManagedObject+Extras.h"

I've tried without the full path (just the class name), and also with single quotes, and no quotes:

 mogenerator -m Project/Data/Model/model.xcdatamodeld -O Project/Data/Managed\ Object --template-var arc=true --base-class-import "NSManagedObject+Extras.h"

However this doesn't regenerate the files.

Everything works fine without --base-class-import:

mogenerator -m Project/Data/Model/model.xcdatamodeld -O Project/Data/Managed\ Object --template-var arc=true

What am I missing or what else can I try?


Solution

  • I got the same problem.

    I think the author's original idea was to import base class from a different header, not the for the NSManagedobject's category.

    And what we want mainly from mogenerator is auto and subclass, for its flexibility on comparison with category.

    And, if you insist on category:

    You can do with:

    mogenerator -m Project/Data/Model/model.xcdatamodeld -O Project/Data/Managed\ Object --template-var arc=true --base-class NSManagedObject --base-class-import "NSManagedObject+Extras.h"

    To denote with NSManagedObject as --base-class to bypass this.