xcode 4 + phonegap ...在构建时不更新JS吗? [英] xcode 4 + phonegap ... not update JS upon build?

查看:38
本文介绍了xcode 4 + phonegap ...在构建时不更新JS吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个奇怪的问题,过去一个小时我不得不挠头.

I've run into a weird issue that has had me scratching my head for the past hour.

我正在使用Xcode 4和PhoneGap开发iPad应用程序.它使用的是jQuery.我已经将所有JS放入了scripts.js文件中.

I'm working on an iPad app using Xcode 4 and PhoneGap. It's using jQuery. I've put all my JS into a scripts.js file.

一切正常.

我花了大约一个小时来做​​很多CSS调整.我将更新CSS文件,停止应用程序,重建并推送到iPad模拟器或我的iPad.一切都很好.CSS文件的每次更新都会反映在新版本中.

I spend about an hour doing a lot of CSS tweaking. I'd update the CSS file, stop the app, rebuild, and push to the iPad simulator or my iPad. That's been working fine. Every update to the CSS file is reflected on the new build.

然后我需要更新JS文件.我无法正常工作,然后我终于意识到我的JS更改实际上都没有放入构建中.我终于完全清空了我的JS文件,对其进行了重建,但它仍然没有更新.

I then needed to update the JS file. I couldn't get things to work and then I finally realized none of my JS changes were actually be put into the build. I finally blanked out my JS file completely, rebuilt, and it's still not updating.

我正在更新的文件正在项目文件夹中的查找器中进行更新(我可以右键单击在查找器中查看",并且该文件的确已更新).

The file I'm updated is being updated in the finder in the project folder (I can right-click 'view in finder' and that file is, indeed, updated).

所以我很困惑.Xcode编译器是否以某种方式缓存JS文件而不是获取更新的文件?有没有办法强迫它获取更新的JS?

So I'm stumped. Is the xcode compiler caching the JS file somehow instead of grabbing the updated file? Is there a way to force it to grab the updated JS?

推荐答案

嗯,经过更多的谷歌搜索之后,这似乎是一个普遍的问题.即使您编辑了Xcode,Xcode似乎仍会缓存它们.

Well, after some more googling, this seems to be a common problem. Xcode seems to cache files even after you've edited them.

一个选项似乎是在新构建之前运行'clean'命令.我尝试过,没有运气.

One option appears to be to run the 'clean' command before a new build. I tried that, no luck.

其他解决方案似乎每次都涉及重建.plist文件.我还没有完全了解如何自动执行此操作,但是确实找到了解决方法:

Other solutions appear to involve rebuilding the .plist file each time. I don't fully understand that (yet) in terms of how to do that automatically, but did find this workaround:

  • 打开您的.plist文件
  • 更改某些内容(以我为例,我每次都会重命名其中一个应用程序图标文件)
  • 保存并构建

这样做神奇地迫使xcode最终抓住所有更新的文件并进行正确的构建.

Doing that magically forces xcode to FINALLY grab all the updated files and do a proper build.

我无法解释为什么Xcode每次都能很高兴地抓住我更新的.css文件,但是如果不先进行.plist文件编辑就不会更新.html或.js文件.

I can't explain why Xcode seems perfectly happy grabbing my updated .css file each and every time but won't update the .html or or .js files without first doing this .plist file edit.

似乎苹果仍然有一些错误需要解决.我猜我们将不得不耐心等待下一个4gig .x版本的发布.;)

Seems as if Apple still has a few bugs to work out. I guess we'll have to wait patiently for the next 4gig .x relase of it. ;)

这篇关于xcode 4 + phonegap ...在构建时不更新JS吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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