4

I moved my Xcode file to iCloud Drive after I wanted to run the app and I got this Error:

Could not determine generated file paths for Core Data code generation: Error Domain=NSCocoaErrorDomain Code=260 "No current version for model at path /Users/sebastianeppler/Library/Mobile Documents/com~apple~CloudDocs/Xcode/OnlyFun/OnlyFun/OnlyFun/OnlyFun.xcdatamodeld:" UserInfo={NSFilePath=/Users/sebastianeppler/Library/Mobile Documents/com~apple~CloudDocs/Xcode/OnlyFun/OnlyFun/OnlyFun/OnlyFun.xcdatamodeld, NSLocalizedDescription=No current version for model at path /Users/sebastianeppler/Library/Mobile Documents/com~apple~CloudDocs/Xcode/OnlyFun/OnlyFun/OnlyFun/OnlyFun.xcdatamodeld:}

3 Answers 3

9

I got this same error when I moved my Core Data Model to a different folder.

Go to your project file. In your Build Phases tab locate the model under Compile Sources and remove it. Then press + to add it back but DO NOT select it from the list you see right away (does not update the file path). Instead select "Add Other" and go select it from it's new location. Then leave the defaults of "copy if needed". Clean your build folder and you're good to go.

In my case this left me with 2 models in my property pane. I deleted the old and dragged and dropped the new one into the correct Xcode group. And all was right with the world again. Hope this helps someone else out.

Sign up to request clarification or add additional context in comments.

3 Comments

Drag/drop is plain stupid and ugly for a such a IDE. What happens if your generated code is needed in CI/CD pipelines? Who is gonna drag/drop them into destination. Isn't there any way to do it with scripts?
You save my night, MAN!
Mine works on my local machine but fails on CI or when I send the project to another Mac, I have to remove the missing file and add it manually to the folder before project builds. Any ideas for how to resolve this?
1

You are probabaly missing the file projectroot/MyProject/MyProject.xcdatamodeld/.xccurrentversion If you can't recover it from your original, the format is like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>_XCCurrentVersionName</key>
        <string>MyProject.xcdatamodel</string>
</dict>
</plist>

2 Comments

Thanks for your answer. I already found my problem. My Project.xcodeproj file was in a wrong folder.
i have tried all the solutions there but non of them worked
-1

I have the same error.

I try to delete all sources file in Compile Sources in tab: Build Phases. Then import all files again.

And selected Product -> Clean and Build. It worked with me.

I think everyone who have the same error could try do it!

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.