Skip to content
This repository

Incorrect header generated #93

Closed
jdmuys opened this Issue February 20, 2012 · 4 comments

2 participants

Jean-Denis Muys Jonathan 'Wolf' Rentzsch
Jean-Denis Muys

Hi,

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$><$Attribute.name$>;

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

Thanks

Jean-Denis Muys

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

- (<$Attribute.objectAttributeType$>)primitive<$Attribute.name.initialCapitalString$>;
- (void)setPrimitive<$Attribute.name.initialCapitalString$>:(<$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

Jonathan 'Wolf' Rentzsch
Owner

Make sure you're using the latest mogenerator via mogenerator --version and make sure you're on the latest templatesm pulling from https://github.com/rentzsch/mogenerator/tree/master/templates if need be.

Jean-Denis Muys

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...

Jean-Denis Muys jdmuys closed this February 20, 2012
Jonathan 'Wolf' Rentzsch
Owner

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
Something went wrong with that request. Please try again.