本文介绍了iphone app升级并移动了xibs / nibs导致过时的资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个未本地化的运送应用程序,在主项目目录中有foo.xib。在准备本地化时,我将其移至en.lproj / foo.xib。现在,当我构建我的应用程序并在我的测试设备上安装时,它最终使用旧的foo.nib,它必须在那之前(安装过程不能删除应用程序包中的旧文件)。从测试设备中删除应用程序并重新安装修复它 - 但我不希望我的现有客户必须这样做。

I have an unlocalized shipping app which has foo.xib in the main project directory. In preparation for localization, I moved this to en.lproj/foo.xib. Now, when I build my app and install on my test device, it ends up using the stale old foo.nib which must be there from before (the installation process must not remove old files in the app's bundle). Deleting the app from the test device and re-installing fixes it -- but I don't want my existing customers to have to do that.

其中一些即将到来从调用UIViewController的-initWithNibName:bundle方法(我目前正在为nibBundle传递nil)。我可以在这里创建一个NSBundle实例,它指向正确的本地化目录。其他在Info.plist或界面构建器的NIB名称部分中指定,我没有看到为这些指定包的方法。

Some of these are coming from calls to UIViewController's -initWithNibName:bundle method (to which I'm currently passing nil for the nibBundle). I can probably create an NSBundle instance here which points at the correct localized directory. The others are specified in Info.plist or in the "NIB Name" section in interface builder and I don't see a way to specify a bundle for those.

它可能只是更容易将我的所有xib重命名为(例如)en.lproj / newfoo.xib,然后我假设它将在运行时找到正确的nib。 (而且我必须记住在新版本中再也不会使用旧的foo.xib名称。)虽然这里有更聪明的解决方案吗? (除了回到过去并从头开始使用en.lproj目录; - )

It might just be easier to rename all my xibs to (e.g.) en.lproj/newfoo.xib, then I presume it will find the correct nib at runtime. (And I'll have to remember to never again use the old "foo.xib" name in a new version.) Is there a more clever solution here though? (Other than going back in time and starting with en.lproj directories from the beginning ;-)

谢谢!
-Mike

Thanks!-Mike

推荐答案

回答我自己的问题以防其他人遇到此问题。看来这是Xcode构建发布周期的工件,当用户通过App Store升级时,这不是问题。我继续发布我的更新,没有人注意到过时资源会导致的问题。

Answering my own question in case anyone else runs into this issue. It appears that this is an artifact of the Xcode build-publish cycle, and it isn't a problem when user's upgrade via the App Store. I went ahead and published my update and no one has noticed problems that would result from stale resources.

作为开发的加速,似乎Xcode只复制资源当您构建并安装到模拟器或测试设备时,它会检测到已更改。 (为了防止每次构建和测试时必须重新复制具有500MB资源的游戏。)当您(重新)从项目中移动资源时,它不会检测到这一点并且(重新)移动旧的副本。我将向Apple提交一个关于它的错误。

As a speedup to development, it appears that Xcode only copies over resources that it detects have changed when you build and install to the simulator or a test device. (To prevent a game with 500MB of resources from having to be re-copied each and every time you build and test.) When you (re)move a resource from a project though, it does not detect this and (re)move the old copy. I will file a bug with Apple about it.

但是,每次升级时,App Store似乎都会进行全新安装(复制用户的文档目录),所以这个来自App Store不是问题。我不确定在向Beta测试人员发送.ipa文件时是否存在问题。

However, the App store does appear to do a clean install with each upgrade (copying over the user's documents directory) so this is not a problem from the App Store. I'm not sure if it is a problem when emailing beta testers an .ipa file or not.

这篇关于iphone app升级并移动了xibs / nibs导致过时的资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-03 08:48