热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

不能在Xcode项目中创建新的xib文件-Can'tcreatenewxibfilesinXcodeprojects

Thisoneisadoozy这是一个非常棒的……MybuddyjustdownloadedtheiPhoneSDKonhisSnowLeopardMacBo

This one is a doozy...

这是一个非常棒的……

My buddy just downloaded the iPhone SDK on his Snow Leopard MacBook Pro. No matter what kind of project he creates (Window Based, View Based, etc...,) he can't create or use his own xib files. The project will compile and run fine until he adds a new xib file.

我的朋友刚刚在他的雪豹MacBook Pro上下载了iPhone SDK。无论他创建什么样的项目(基于窗口、基于视图等等),他都不能创建或使用自己的xib文件。这个项目将编译并正常运行,直到他添加一个新的xib文件。

Here are some symptoms:

这里有一些症状:

  • When he selects a pre-generated xib in Xcode (such as MainWindow.xib), no preview is shown on the right hand side. Double clicking on this file will open it in interface builder (This is correct behavior).
  • 当他在Xcode(例如MainWindow.xib)中选择一个预先生成的xib时,在右边没有显示预览。双击这个文件将在interface builder中打开它(这是正确的行为)。
  • When he selects his own custom xib, the preview pane displays the XML content of the xib. Double clicking on his custom xib opens up the XML file in Xcode - as if it were a standard code file (This is jacked up).
  • 当他选择自己的自定义xib时,预览窗格将显示xib的XML内容。双击他的自定义xib,打开Xcode中的XML文件——就好像它是一个标准的代码文件(这是被加起来的)。
  • Opening his custom xib from finder opens it in Interface Builder.
  • 从finder中打开他的自定义xib,在Interface Builder中打开它。
  • When building the application, the build warning says something to the effect of "Warning: No rule to process file /path/to/CustomXib of type sourcecode.xib for architecture i386"
  • 构建应用程序时,构建警告的作用是“警告:没有处理源码类型的文件/路径/到/CustomXib的规则”。xib i386架构”
  • At runtime he gets the error:

    在运行时,他会得到错误:

    Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] was unable to load a nib named "MyCustomXib"'

    由于未捕获异常“NSInvalidArgumentException”而终止应用程序,原因是:“-[UIViewController _loadViewFromNibNamed:bundle:]无法加载名为“MyCustomXib”的nib

We've uninstalled Xcode from the command line and reinstalled. I've verified that it's the right version for his machine. I'm stumped!

我们已经从命令行卸载Xcode并重新安装。我已经证实这是他的机器的正确版本。我难住了!

5 个解决方案

#1


1  

Yes, I also had this problem and also upgraded directoy from Tiger to Snow Leopard. The fix for me was changing the file type of the nib file from sourcecode.xib to file.xib (control click on the nib file, select "Get Info", and modify the "File Type" in the dropdown.

是的,我也有这个问题,并且把directoy从Tiger升级到Snow Leopard。我的解决方案是从源代码中修改nib文件的文件类型。xib文件。xib(控制点击nib文件,选择“获取信息”,并在下拉菜单中修改“文件类型”。

#2


1  

The error...

错误……

Warning: No rule to process file /path/to/CustomXib of type sourcecode.xib for architecture i386"

警告:没有处理源代码类型的文件/路径/到/CustomXib的规则。xib i386架构”

... suggest the nib is for some reason in the "Compile Sources" build phase. Open the target and then open Compile Sources and see if the nib is listed there. If it is, move it to "Copy Bundle Resources" and try to compile again.

…建议nib在“编译源”构建阶段出于某种原因。打开目标,然后打开编译源,看看nib是否列在那里。如果是,请将其移动到“复制绑定资源”并尝试重新编译。

#3


0  

Try changing the file type of the xib from "sourcecode.xib" to "file.xib". "sourcecode.xib" seems like it would try to treat the file as a source file, and not as the (default) xib file.

尝试从“sourcecode”更改xib的文件类型。xib”到“file.xib”。“源代码里。xib“似乎它试图将文件视为源文件,而不是(默认)xib文件。

#4


0  

This is a total cop out, but after screwing around with Xcode, OS X, the terminal and seeing no progress, we've decided to wipe the machine and start fresh. The bug may be a consequence of upgrading directly from Tiger to Snow Leopard, and having some strange left-over settings.

这完全是一种逃避,但是在使用了Xcode、OS X、终端之后,我们发现没有任何进展,于是我们决定把机器擦干净,重新开始。这个bug可能是直接从Tiger升级到Snow Leopard,并设置了一些奇怪的遗留设置。

#5


0  

It seems my xib- file was saved with wrong file info when created by File->New_file->Create an UIViewController subclass in XCode.

看起来我的xib- file被file-> New_file->在XCode中创建一个UIViewController子类时保存了错误的文件信息。

When I changed the file info into the same as for the MainWindow.xib, and also moved it from the Target compile folder, it worked fine; it both compiled and started in interface builder.

当我将文件信息更改为与主窗口相同时。xib,并将其从目标编译文件夹中移动,运行良好;它在接口构建器中编译并启动。

PS: I too upgraded directly from Tiger to Snow Leopard, so that could be a candidate for mixing the settings of Xcode?

PS:我也直接从Tiger升级到Snow Leopard,所以有可能混合Xcode的设置?


推荐阅读
author-avatar
铁骑侠客_685
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有