如何将带有自定义扩展名的文件添加到 XCode 中的包/资源文件夹?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6745113/
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 add file with custom extension to bundle/resource folder in XCode?
提问by Rizki
I have a problem. I have been made a file with custom extension like .xyz in resource folder. But when I running the application, the file wasn't in resource folder. How can I add the file with custom extension? Anybody can help me?
我有个问题。我已经在资源文件夹中创建了一个带有自定义扩展名的文件,例如 .xyz。但是当我运行应用程序时,该文件不在资源文件夹中。如何添加带有自定义扩展名的文件?任何人都可以帮助我吗?
Thanks before. Regards.
之前谢谢。问候。
回答by Richard
You need to make sure that this .xyz file is in the Copy Resources phase of your application's target.
您需要确保此 .xyz 文件处于应用程序目标的复制资源阶段。
回答by Rahul Vyas
simple drag n drop to your resources folder and check copy items to resources folder option. That's it.
简单的拖放到您的资源文件夹并检查将项目复制到资源文件夹选项。就是这样。
回答by R. Dewi
what do you mean with "the file wasn't in resource folder" ?
do you want to move it into Documentsdirectory ?
if yes, you just can move your file from resourceinto Documents, i was do something like that with this code :
“文件不在资源文件夹中”是什么意思?你想把它移到Documents目录中吗?如果是,您只需将您的文件从resourceinto移动Documents,我就是用这个代码做类似的事情:
[[NSFileManager defaultManager] moveItemAtPath:resourcePath toPath:documentsPath error:NULL];

