Xcode4 损坏 nib 文件

发布于 2024-10-28 23:08:26 字数 625 浏览 1 评论 0原文

我有一个相当奇怪的问题,我还不能完全弄清楚,我想在这里记录它,因为我还没有在其他地方看到过这个问题。

我有一个在 Xcode3 下开发的 iPhone 应用程序。这是完美的工作,我已经做了一些临时分发,在设备上也完美工作。

然后我升级到 Xcode4,下次我进行临时分发时,我的应用程序在启动时崩溃了。不用说,它可以在模拟器和连接到我的开发机器的设备中运行。崩溃日志没有太大帮助,它们表明 main.m 中对 UIApplication 的标准调用发生了崩溃。当然,我从未更改过该文件。经过大量挖掘和拼凑,我发现了问题所在。

Xcode 认为我的 *.xib 文件的文件类型是 text.xml 而不是 file.xib,因此仅将这些文件复制到应用程序包而不是编译它们。该应用程序随后在启动时崩溃,因为它找不到 MainWindow.nib 文件。

通过回溯我的 subversion 签入,我发现 xcodeproj 内的 project.pbxproj 文件中记录的文件类型在 Xcode4 升级后的第一次签入中发生了变化。我不知道这是如何或为何发生的。我也无法通过 UI 看到我将如何影响该设置,而且我什至没有打开一些已更改的 xib。 (为了解决我的问题,我在文本编辑器中修改了 pbxproj 文件)。

那么,有人知道这种情况如何或为何发生吗?

I have a rather strange problem that I can't quite get to the bottom of just yet, and I want to document it here because I haven't seen this problem discussed anywhere else.

I have a iPhone app that I was developing under Xcode3. This was working perfectly and I had done some ad-hoc distribution that also worked perfectly on devices.

Then I upgraded to Xcode4 and the next time I did an ad-hoc distribution my app crashed on startup. Needless to say that it worked in the simulator and in devices hooked up to my development machine. The crash logs were none too helpful, they indicated a crash in main.m, in the standard call to UIApplication. I, of course, had never changed that file. After much digging and piecing together I discovered the problem.

Xcode thought that the file type of my *.xib files was text.xml instead of file.xib and so was only copying these files to the app bundle instead of compiling them. The app was then crashing on startup because it couldn't find the MainWindow.nib file.

By tracing back through my subversion checkins I found that the file types, as recorded in the project.pbxproj file within xcodeproj, changed in the first checkin after the Xcode4 upgrade. I have no idea as to how or why that happened. Nor I can see through the UI how I would influence that setting and I didn't even open some of the xib's that changed. (To fix my problem I modified the pbxproj file in a text editor).

So, does any-one have any insight as to how or why this could have happened?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

甲如呢乙后呢 2024-11-04 23:08:26

我已经迁移到 xcode4 的现有 xcode3 项目遇到了同样的问题。

我尝试了@jaylinn的解决方案,但我也发现该文件已经有lastKnownReference。

我已经能够通过从项目中删除 .xib 文件(仅删除引用)然后将它们重新添加到项目中来解决此问题。虽然有点痛苦,但确实有效。

希望有帮助。
-麦克风

I'm running into the same problem with my existing xcode3 projects that I have migrated to xcode4.

I tried @jaylinn's solution, but I too found the file already had lastKnownReference.

I have been able to resolve this by deleting the .xib files from the project (Remove Reference Only) and then re-adding them to the project. It's a bit of a pain, but it works.

Hope that helps.
-Mike

软糖 2024-11-04 23:08:26

这是为我们解决的问题。 XIB 被识别为“explictFileType”,在 Xcode 4 中似乎无法识别。

在项目文件中查找类似这样的行(使用文本编辑器打开)...

C9B10BEA11D9084800F10866 /* Record.xib */ = { isa = PBX文件参考; explicitFileType = file.xib;路径=记录.xib;源树=“”; };

并将其更改为这样...

C9B10BEA11D9084800F10866 /* Record.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib;路径=记录.xib;源树=“”; };

Here's what fixed it for us. The XIB was identified as an "explictFileType" which does not appear to be recognized in Xcode 4.

Look for a line like this in your project file (open with a text editor) ...

C9B10BEA11D9084800F10866 /* Record.xib */ = {isa = PBXFileReference; explicitFileType = file.xib; path = Record.xib; sourceTree = ""; };

And change it to this ...

C9B10BEA11D9084800F10866 /* Record.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = Record.xib; sourceTree = ""; };

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文