Note that there are some explanatory texts on larger screens.

plurals
  1. POpathForResource:ofType: returns 'nil' if a build rule for 'Data model version files' is used
    primarykey
    data
    text
    <p>I am trying to setup CoreData in a new project, but somehow am stuck locating the momd directory.</p> <p>I found several stackoverflow posts with similar questions, but was unable to solve the problem with the supplied answers. So here it is: What causes the first line to return 'nil' and the second one actually finds the momd directory?</p> <pre><code>NSURL *modelURL = [NSURL fileURLWithPath: [[NSBundle mainBundle] pathForResource:@"Project" ofType:@"momd"] ]; NSURL *modelURL = [NSURL fileURLWithPath: @"/Users/name/Library/Developer/Xcode/DerivedData/Project-afusjhpzsjyjdbesttxposfzlzrj/Build/Products/Debug/Project.app/Contents/MacOS/Project.momd" ]; </code></pre> <p>Edit: As Metabble commented, It's now logical that the mainbundle is unable to locate resources outside the Resources folder.</p> <p>But my problem still exists. I found out some more: I am using mogenerator to generate classes. (I used these instructions: <a href="http://www.esenciadev.com/2011/05/mogen-and-xcode4-integration/" rel="nofollow">http://www.esenciadev.com/2011/05/mogen-and-xcode4-integration/</a>). A script is called by a build rule process 'Data model version files'. In that build rule I've set the output to '${DERIVED_FILES_DIR}/${INPUT_FILE_BASE}.momd' but it looks like that is not the correct destination for the momd:</p> <pre><code>error: Could not create bundle folder for versioned model at '/Users/user/Library/Developer/Xcode/DerivedData/Project-afusjhpzsjyjdbesttxposfzlzrj/Build/Products/Debug/Project.app/Contents/MacOS/Project.momd' </code></pre> <p>If I delete the build rule, the code can find the momd. But that disables mogenerator...</p> <p>Anybody know what output files I need to set in the build rule?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload