如何更正 xcode iOS 项目中丢失的文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13231706/
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
How to correct missing files in xcode iOS project
提问by hanumanDev
I have a project with some missing files. The files are their own folder on the same level as the iOS app project folder. Not sure why but the files are showing up as "missing"
我有一个缺少一些文件的项目。这些文件是它们自己的文件夹,与 iOS 应用程序项目文件夹处于同一级别。不知道为什么,但文件显示为“丢失”
Is there something I can do to the Library Search Paths (see screenshot below) so they find them correctly?
我可以对图书馆搜索路径(见下面的截图)做些什么,以便他们正确找到它们?
fyi: I inherited the project, so it was just sent to me. I try to build it and get all those files missing.
仅供参考:我继承了这个项目,所以它刚刚发送给我。我尝试构建它并丢失所有这些文件。
thanks for any help :)
谢谢你的帮助 :)
回答by WDUK
It's nothing to do with library search paths, they are used to find libraries to compile against; they're nothing to do with source files contained within your project.
这与库搜索路径无关,它们用于查找要编译的库;它们与项目中包含的源文件无关。
They are missing because your project file is trying to reference a location for the file that doesn't exist. You have two options:
它们丢失是因为您的项目文件试图引用不存在的文件的位置。您有两个选择:
If you have all the missing files on hand in Finder, you can delete the references to them in Xcode, and re-import them. Do this by dragging them back into the project from Finder.
You can instead 'fix' your project file, to have it refer to the right place. To do this, use the File Inspector on the right, and under Location, select the 'box' icon (not sure what it is, but select it), and relocate your file.
如果您在 Finder 中拥有所有丢失的文件,您可以在 Xcode 中删除对它们的引用,然后重新导入它们。通过将它们从 Finder 拖回到项目中来完成此操作。
您可以改为“修复”您的项目文件,使其指向正确的位置。为此,请使用右侧的文件检查器,在“位置”下,选择“框”图标(不确定它是什么,但请选择它),然后重新定位您的文件。
回答by Ankur Arya
open the folder in which these files are present then drag and drop the missing files in you project. check the "copy items into destination group's folder(if needed)", choose "create groups for any added folders".
打开包含这些文件的文件夹,然后将丢失的文件拖放到项目中。选中“将项目复制到目标组的文件夹(如果需要)”,选择“为任何添加的文件夹创建组”。
回答by Trausti Thor
Remove these files from the project view (list on the left side), drag them back into the project and make sure you don't select Copy to project, but you also have to check which target to put in.
从项目视图(左侧列表)中删除这些文件,将它们拖回项目并确保您没有选择复制到项目,但您还必须检查要放入的目标。