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

Closed
fritza opened this Issue Aug 11, 2013 · 17 comments

Comments

Projects
None yet

fritza commented Aug 11, 2013

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
/Users/fritza/Desktop/KillMeMogenerator/KillMeMogenerator

$ ls
Base.lproj          KillMeMogenerator-Info.plist
Images.xcassets         KillMeMogenerator-Prefix.pch
KMGAppDelegate.h        Model.xcdatamodeld
KMGAppDelegate.m        en.lproj
KMGViewController.h     main.m
KMGViewController.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.

marklarr commented Nov 9, 2013

@mpillsbury 👍, this is a pretty big issue for new users.

nbrew commented Nov 25, 2013

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

2bj commented Jan 27, 2014

@mpillsbury thanks, 👍

siuying commented Jan 28, 2014

@mpillsbury it worked!

dglancy commented May 6, 2014

for this workaround. 9 months later 👍

link82 commented Jun 11, 2014

Worked!! Thank you 👍

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: http://d.pr/i/UwUt

... I'm stumped 😕

siuying commented Aug 22, 2014

@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/PilotPro.build/Debug-iphonesimulator/Mogenerator.build/Script-AF1A110719A6F4A4004E3BF7.sh: 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
mogen

Mazyod commented Sep 4, 2014

@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!

You are able to circumvent this fatal error if you don't user Xcode's generated Core data model.
Just leave that box empty. Then in your project go to 'New'->'file'->'core data'->'data model'

Verified that this works with Xcode v-6.4
demo

Collaborator

justin commented Dec 26, 2015

If this is still an issue in Xcode 7, please open a new issue and we can see if theres something we can do.

justin closed this Dec 26, 2015

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