Incorrect header generated #93

jdmuys opened this Issue Feb 20, 2012 · 4 comments


None yet

2 participants

jdmuys commented Feb 20, 2012


I just upgraded to 1.25 and started a new project, where the generated machine headers are wrong. For String and Date attributes, mogenerator generates:

@property (nonatomic, strong) NSDatedate;
@property (nonatomic, strong) NSStringkind;

Where clearly a space and a * is missing.

Indeed, the template has:

@property (nonatomic, strong) <$Attribute.objectAttributeType$><$$>;

Did I miss anything?

I invoke mogenerator with this script line:

mogenerator --template-var frc=true --template-var arc=true --model "${INPUT_FILE_PATH}/${INPUT_FILE_BASE}.xcdatamodel" --output-dir "${INPUT_FILE_DIR}/" --base-class JDManagedObject


jdmuys commented Feb 20, 2012

If I "fix" the template (adding a * and space), then similar bad code is generated by those two lines:

- (<$Attribute.objectAttributeType$>)primitive<$$>;
- (void)setPrimitive<$$>:(<$Attribute.objectAttributeType$>)value;

Where the * is missing too.

So I add the missing * there, and now, the generated code compiles fine.

I forgot to mention this is with Xcode 4.4dp1


Make sure you're using the latest mogenerator via mogenerator --version and make sure you're on the latest templatesm pulling from if need be.

jdmuys commented Feb 20, 2012

The lines I quoted are straight from github. As I wrote, I just upgraded to 1.25 (using homebrew). It turns out that when you do that, the homebrew version doesn't replace the previously installed version. So 1.24 was still being run! (I had previously installed 1.24 using the installer).

The only suggestion I have to prevent that from happening, is to tag the templates with the version of mogenerator they are supposed to run with, and for mogenerator to check and warn if it finds a discrepancy.

Of course, this is an edge case...

@jdmuys jdmuys closed this Feb 20, 2012

Eventually the default templates will be built into the mogenerator binary (#79) so this won't be an issue in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment