Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


1.27 asserts on -[MOGeneratorApp setModel:] (current rev is OK) #169

fritza opened this Issue · 15 comments

The latest public release (1.27) asserts in -[MOGeneratorApp setModel:] for a stupid-simple xcdatamodeld. This is fixed in the latest revision, (e8a05a316), but I have to explain mogenerator to a readership that can't be trusted to clone a Git repo.

Supplying the .xcdatamodel inside the .xcdatamodeld cures the problem in 1.27.

The notes for 1.27 advertise the handling of .xcdatamodeld as an enhancement in that release.

Can a 1.28 possibly be packaged-up in the next few weeks?

Always recognizing I may be doing something boneheaded.

Sample project in Dropbox.

$ mogenerator -v
mogenerator 1.27. By Jonathan 'Wolf' Rentzsch + friends.

$ pwd

$ ls
Base.lproj          KillMeMogenerator-Info.plist
Images.xcassets         KillMeMogenerator-Prefix.pch
KMGAppDelegate.h        Model.xcdatamodeld
KMGAppDelegate.m        en.lproj
KMGViewController.h     main.m

$ mogenerator --model Model.xcdatamodeld/
Assertion failed: (model), function -[MOGeneratorApp setModel:], file /Users/wolf/code/github/mogenerator/mogenerator.m, line 681.
Abort trap: 6

$ mogenerator --model Model.xcdatamodeld/Model.xcdatamodel/
4 machine files and 4 human files generated.


I ran into this too, but I was able to work around it.

  1. Create a new data model version and set it to be the "current" model.
  2. Run mogenerator. For whatever reason, mogenerator succeeds with the model in this state.
  3. Follow these instructions to remove the original (superfluous) model version.
  4. Now mogenerator runs fine.

@mpillsbury :+1:, this is a pretty big issue for new users.


@mpillsbury Thanks for the workaround. I was just trying mogenerator for the first time this afternoon and your instructions help me actually generate my models.


@mpillsbury thanks, :+1:


@mpillsbury it worked!


for this workaround. 9 months later :+1:


Worked!! Thank you :+1:


Hey @mpillsbury can you explain how to set the "current" model in Xcode? I'm not seeing anywhere to do that.


When you have your xcdatamodel selected in Xcode, make sure that you have the right-pane enabled. You'll see it over there.


That's bizarre... I don't have that section:


... I'm stumped :confused:


@cliftonlabrum if you have not added new versions to your model, the "Model Version" will not show. You can add version in "Editor" menu.

screen shot 2014-08-22 at 4 51 05 pm


Thanks, everyone. I created a new model version, set it to be the current one, then attempted to build Mogenerator again in Xcode, and it still fails with this error:

Assertion failed: (model), function -[MOGeneratorApp setModel:], file /Users/wolf/code/github/mogenerator/mogenerator.m, line 681.

/Users/Clifton/Library/Developer/Xcode/DerivedData/PilotPro-filxyzjonkycoudxopysgsddcbuj/Build/Intermediates/ line 2: 59537 Abort trap: 6           mogenerator -m /Users/Clifton/Mobile/PilotPro/Global/Core\ Data/Tempy.xcdatamodeld -O /Users/Clifton/Mobile/PilotPro/Global/Models --template-var arc=true
Command /bin/sh failed with exit code 134

I assume I'm building it right by selecting Mogenerator to be the target and hitting Command+B


@cliftonlabrum in my case, making a change like this fixes the issue:

FROM: /Users/Clifton/Mobile/PilotPro/Global/Core\ Data/Tempy.xcdatamodeld 
TO: /Users/Clifton/Mobile/PilotPro/Global/Core\ Data/Tempy.xcdatamodeld/Tempy.xcdatamodel

As one of the users above suggested.


@mpillsbury you saved my time! Thanks!

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.