Xcode,无法读取包内容(错误域=NSCocoaErrorDomain 代码=260

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/33860086/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 08:14:32  来源:igfitidea点击:

Xcode, Cannot read bundle contents (Error Domain=NSCocoaErrorDomain Code=260

iosxcodeswift

提问by Klas Zetterlund

I am at my wits end. I've been messing around trying to change the name of my iphone-app and have apparently broken something. When I try to build I get the error message

我没办法。我一直在尝试更改我的 iphone 应用程序的名称,但显然已经破坏了某些东西。当我尝试构建时收到错误消息

/Users/john/Desktop/ubernerds/fardig/renrakat.xcdatamodeld: Cannot read bundle contents (Error Domain=NSCocoaErrorDomain Code=260 "The folder “renrakat.xcdatamodeld” doesn't exist." UserInfo={NSFilePath=/Users/john/Desktop/ubernerds/fardig/renrakat.xcdatamodeld, NSUserStringVariant

/Users/john/Desktop/ubernerds/fardig/renrakat.xcdatamodeld:无法读取包内容(错误域=NSCocoaErrorDomain Code=260“文件夹“renrakat.xcdatamodeld”不存在。” UserInfo={NSFilePath=/Users/john /Desktop/ubernerds/fardig/renrakat.xcdatamodeld, NSUserStringVariant

There is a file called renrakat.xcdatamodeldin the folder fardigt, so what could be the problem? When I start my backup copy (made before I started making dumb changes) I get the same error when I try to build

文件renrakat.xcdatamodeld夹中有一个名为的文件fardigt,那么可能是什么问题?当我开始我的备份副本(在我开始进行愚蠢的更改之前制作)时,我在尝试构建时遇到了同样的错误

Please help!

请帮忙!

I'm running xcode 7.1.1

我正在运行 xcode 7.1.1

采纳答案by Klas Zetterlund

When I ran the /Users/john/Desktop/ubernerds/fardig/renrakat.xcdatamodeld/ ] && echo "File exists" || echo "File do not exitsts" in the terminal I ofund that the file was indeed in the wrong folder. Moved it and everything worked fine

当我运行 /Users/john/Desktop/ubernerds/fardig/renrakat.xcdatamodeld/ ] && echo "文件存在" || 在终端中回显“文件不存在”,我发现该文件确实位于错误的文件夹中。移动它,一切正常

回答by LukeSideWalker

Maybe the following "work-around" could help !?

也许以下“解决方法”可以帮助!?

    1. Start a brandneu project
    1. Name it the way you want
    1. Copy all resources from the damaged project to the new project
    1. Try building again
    1. 开始一个brandneu项目
    1. 以您想要的方式命名
    1. 将损坏项目中的所有资源复制到新项目中
    1. 再次尝试构建

回答by ngoctung.nguyen2408

If you can not find the lost file:

如果找不到丢失的文件:

You create a new xcdatamodeld (right click on the old xcdatamodeld that error -> new file)

您创建一个新的 xcdatamodeld(右键单击该错误的旧 xcdatamodeld -> 新文件)

Xcode will create model.xcdatamodel

Xcode 将创建 model.xcdatamodel

copy and paste old name to the new xcdatamodel (also delete old.xcdatamodeld first) and run project

将旧名称复制并粘贴到新的 xcdatamodel(也首先删除 old.xcdatamodeld)并运行项目

the xcdatamodel folder in your project folder will replace with "old name 2 xcdatamodel folder"

项目文件夹中的 xcdatamodel 文件夹将替换为“旧名称 2 xcdatamodel 文件夹”