Xcode没有将最新的资源文件复制到iPhone [英] Xcode not copying latest resource file to iPhone

查看:126
本文介绍了Xcode没有将最新的资源文件复制到iPhone的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Xcode在Objective-C中编写iPhone应用程序,并且我在设备上运行了一些Lua脚本。

I'm writing an iPhone app in Objective-C with Xcode and I have some Lua scripts that run on the device.

我遇到问题如果我编辑Lua脚本,保存,轻拂到Xcode和构建并运行(⌘Y),该Lua脚本的最新版本将被复制到应用程序包中,但不会复制到设备中。

I'm having an issue where if I edit a Lua script, save, flick over to Xcode and Build and Run (⌘Y) the latest version of that Lua script is copied into the app bundle but not copied to the device.

脚本不在Xcode项目中,我在Textmate中编辑它们。我有一个构建步骤,将脚本复制到应用程序包中并触摸文件,运行正常,最新的脚本版本在我运行应用程序时在应用程序包中。这些文件都已被触及,但出于某种原因,当将软件包复制到设备时,Xcode决定不复制最新文件。

The scripts aren't in the Xcode project, I edit them in Textmate. I have a build step which copies the scripts into the app bundle and touches the files, this is being run fine and the latest script version is in the app bundle when I run the app. The files have all been touched, but for some reason when copying the bundle to the device Xcode decides not to copy the latest.

如果我停止应用程序然后构建和再次运行(⌘Y),复制最新版本。

If I stop the app and then Build and Run (⌘Y) again, the latest version is copied across.

我的解决方法是保存Lua文件,然后在Xcode中执行构建(⌘B)然后构建并运行(⌘Y),因此请构建应用程序两次。这似乎总是将最新版本复制到设备。

My workaround is to save the Lua file, then in Xcode do a Build (⌘B) and then Build and Run (⌘Y), so build the app twice. This always seems to copy the latest version to the device.

更新:

正如许多人所指出的,一种解决方案是清理目标并重建。你可以这样做,你也可以建立两次,如上所述。这个问题很容易重现(在我的设置中,它每次都会发生,无论最近目标是如何清理的)。我希望有一个更可靠/永久的解决方案

As many have noted, one solution is to clean the targets and rebuild. You can do this, you could also build twice as I have noted above. This problem is easily reproducible (in my setup it happens every time, regardless of how recently the targets were cleaned). I'm hoping for a more reliable/permanent solution

推荐答案

您一定要将这些文件添加到您的XCode项目中。您仍然可以在其他编辑器中编辑它们,但如果将XCode添加到项目中,XCode会自动将它们包含在您的包中。如果在构建时没有复制它们,我就是这样解决的:

You should definitely add those files to your XCode project. You can still edit them in your other editor, but XCode will include them in your bundle automatically if you add it to the project. If they aren't getting copied when you build, this is how I resolve it:


  • 右键单击XCode中的文件并选择触摸更新文件上的时间戳,使其看起来是新的。

  • Right click on the file in XCode and choose "Touch" which updates the timedate stamp on the file, so it looks "new".

在模拟器上,选择重置内容和设置。文件菜单。

On the simulator, choose Reset Content and Settings from the File Menu.

在XCode中,执行Build Clean

In XCode, do a Build Clean

当你构建并运行之后它应该安装文件就好了。

When you build and run after that it should install the file just fine.

编辑:

要将项目中包含的外部文件夹添加到您的包中并保持文件夹结构不变,您需要做的就是:

To add external folders to your project that will get included in your bundle and preserve the folder structure intact, all you need to do is:


  • 单击左侧文件列表顶部的项目图标。

  • Click on the project icon at the top of the file list on the left.

单击项目菜单,然后单击添加到项目。

Click the Project menu and Add to Project.

选择要包含的文件夹,然后单击添加。

Select the folder you want to include and click Add.

取消选中复制复选框,然后将为任何添加的文件夹递归创建组更改为为任何添加的文件夹创建文件夹参考。

Unchecked the Copy checkbox and change "Recursively create groups for any added folders" to "Create Folder References for any added folders".

构建目标时,打开捆绑包,您的目录结构将完全存在于内部。

When the target is built, open up the bundle and your directory structure will exist inside fully intact.

这篇关于Xcode没有将最新的资源文件复制到iPhone的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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