簡體   English   中英

Swift錯誤:無法確定生成Core Data代碼的生成文件路徑:

[英]Swift error: Could not determine generated file paths for Core Data code generation:

在我想運行應用程序后,我將Xcode文件移動到iCloud Drive,我收到此錯誤:

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:}

當我將Core Data Model移動到另一個文件夾時,我遇到了同樣的錯誤。

轉到您的項目文件。 在“構建階段”選項卡中,在“編譯源”下找到模型並將其刪除。 然后按+將其添加回來,但不要從您剛看到的列表中選擇它(不更新文件路徑)。 而是選擇“添加其他”並從其新位置選擇它。 然后保留默認值“如果需要,復制”。 清理你的構建文件夾,你很高興。

在我的情況下,這讓我在我的屬性窗格中有兩個模型。 我刪除了舊的並將其拖放到正確的Xcode組中。 一切都是對世界的正確。 希望這有助於其他人。

您可能錯過了文件projectroot/MyProject/MyProject.xcdatamodeld/.xccurrentversion如果您無法從原始文件中恢復它,格式如下:

<?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>

我有同樣的錯誤。

我嘗試在選項卡的“ Compile Sources中刪除所有源文件: Build Phases 然后再次導入所有文件。

並選擇Product - > CleanBuild 它與我合作。

我想每個有同樣錯誤的人都可以嘗試一下!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM