资源文件未使用Xcode 5进行更新 [英] Resource files not updating with Xcode 5

查看:75
本文介绍了资源文件未使用Xcode 5进行更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些带有专有扩展的二进制文件,在编译时没有在构建中更新。在具有相同项目的Xcode的早期版本中,它会检测到文件已更改,并且很少我必须执行清理,因为我必须使用此版本。当然这会花费更多的时间 - 如果有人能让我知道Xcode 5的变化和/或我能做些什么,我将不胜感激。

I have some binary files with a proprietary extension that don't get updated in a build when I compile. In previous versions of Xcode with this same project, it would detect the file was changed, and rarely would I have to perform a 'Clean' as I have to do with this version. Of course this is consuming a lot more time -- I would appreciate it if someone could let me know what's changed with Xcode 5 and/or what I could do about this.

我没有包含任何项目细节,因为它实际上只是一个专有的二进制文件,在资源文件夹中有自定义扩展,用于自上次编译后自动更新。如果您需要任何特定的项目设置,我很乐意提供它。

I didn't include any project specifics because it's really just a proprietary binary file with a custom extension in a resource folder, which, used to update automatically upon it being changed since last compile. If you need any specific project settings I would be glad to offer it.

它使用的是那种蓝色资源文件夹,它是对它所在文件夹的引用,并且不仅仅是复制到项目目录中。我道歉,因为我忘记了这个特定的资源文件夹类型被调用(我猜测参考)。

It's using the sort of 'blue' resource folder that is a reference to the folder it's in, and isn't just copied into the project directory. I apologize since I forget what this particular resource folder type is called (I'm guessing Reference).

版本:Xcode 5(5A1413)

Version: Xcode 5 (5A1413)

UPDATE:

这只发生在我引用我用fopen,fwrite等编程修改的文件时,以及使用OSX中的文件编辑器重新保存文件(没有真正改变它)Xcode然后将其视为已更改。

This only happens when I'm referencing a file that I modify programmatically with fopen,fwrite,etc, and upon using a file editor in OSX to resave the file (without really changing it) Xcode will then see it as changed.

我现在正在研究FSEvents以查看此基础API是我需要使用的东西,虽然我还不确定如何设置这个标志。

I'm now looking into FSEvents to see if this underlying API is something I need to use, although I'm not exactly sure how to set flags with this just yet.

更新:

嗯,就像一个简单的测试一样,我拿同一个文件并通过以下方式重新保存:

Well, just as a simple test, I take the same file and resave it via:

NSData* data = [[NSData alloc] initWithContentsOfFile: @"/location/file.dat"];
[data writeToFile:@"/location/file.dat" atomically:YES];

当然,在我调用它然后运行使用该资源的应用程序之后,它会在构建期间通过Xcode更新。因此,似乎Xcode 5依赖于一些未由标准io函数设置的特殊标志。在这一点上,我可以修补我用2行的东西,或者弄清楚标记机制是什么,以及如何写入它。 (FSEvents?我在那里看不到写作机制..)

Sure enough, after I call that and then run the app that uses the resource, it is updated via Xcode during the build. So it would seem that Xcode 5 relies on some special flags not set by the standard io functions. At this point I can either patch what I've got with that 2 line thing or figure out what the flagging mechanism is, and how to write to it. (FSEvents? I don't see a writing mechanism there..)

推荐答案

我也遇到了问题。在Xcode 5之前一切都很好,我引用的资源文件夹将非常可靠地复制。但是,在更新之后,无论我对单个文件做了什么(触摸,删除并重新复制等),都没有触发Xcode再次挖掘它。

I was also running into problems. Everything was fine before Xcode 5, and my referenced resources folder would copy pretty dependably. However, after updating, no matter what I did to an individual file (touch it, delete and re-copy it, etc.), nothing triggered Xcode to scoop it up again.

但是,我现在在构建步骤中修改引用文件夹的上次写入时间,现在它的内容似乎再次正确复制。我希望对你也有所帮助。

However, I now modify the last write time on the referenced folder during my build step, and now it's contents seem to be copying correctly again. I Hope that helps you too.

我正在使用自定义工具,但我确信构建脚本可以做同样的事情。我的猜测是Xcode尝试优化依赖步骤,并在潜入之前检查文件夹的最后访问/写入时间。

I am using custom tools, but I'm sure a build script can do the same. My guess is that Xcode tries to optimize the dependency step, and checks the folder's last access/write times before diving into it.

这篇关于资源文件未使用Xcode 5进行更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆