0

While I was busy trying out stuff for this question, I accidently removed the xcdatamodel-package.

I found out that recently there was this question which mentioned the following:

For some reason, the xdatamodel was removed from the build settings. I added it back in and it worked.

I tried doing what he did, but I don't know where to start.

I recreated the package, but when I try to set an attribute value, I get +entityForName: could not locate an entity named 'EN'...

All I know is; it did work until I started fooling around with not-tutorial-attributes and stuff.

Community
  • 1
  • 1
Joshua W
  • 111
  • 10

1 Answers1

1

What they're getting at in that other question is that when you add a file to a project, it's not necessarily added to the current target. You can have multiple targets in a project, and you can add files that don't get compiled (e.g. developer documentation), so it's possible to add a file but then have it just sit there and not get built.

If you select the file in Xcode and open up the Utilities pane on the right, there's a section that shows target membership. It looks like this:

target membership

This one shows that the file belongs to the project momdecTests but not to the project momdec. Make sure your app target is checked here.

Tom Harrington
  • 69,312
  • 10
  • 146
  • 170
  • Thanks! I hoped it was just the lack of membership, but it now shows it already had membership. Any ideas on the error then? – Joshua W Oct 15 '13 at 19:45
  • Maybe you're not creating an instance of `NSManagedObjectModel`? Hard to say without more detail about the project and its code. – Tom Harrington Oct 15 '13 at 19:56
  • [Some details](http://stackoverflow.com/questions/19390501/entityforname-could-not-locate-an-entity-named-entityname) ;) – Joshua W Oct 15 '13 at 20:33