热门标签 | 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的设置?


推荐阅读
  • 自动轮播,反转播放的ViewPagerAdapter的使用方法和效果展示
    本文介绍了如何使用自动轮播、反转播放的ViewPagerAdapter,并展示了其效果。该ViewPagerAdapter支持无限循环、触摸暂停、切换缩放等功能。同时提供了使用GIF.gif的示例和github地址。通过LoopFragmentPagerAdapter类的getActualCount、getActualItem和getActualPagerTitle方法可以实现自定义的循环效果和标题展示。 ... [详细]
  • Java太阳系小游戏分析和源码详解
    本文介绍了一个基于Java的太阳系小游戏的分析和源码详解。通过对面向对象的知识的学习和实践,作者实现了太阳系各行星绕太阳转的效果。文章详细介绍了游戏的设计思路和源码结构,包括工具类、常量、图片加载、面板等。通过这个小游戏的制作,读者可以巩固和应用所学的知识,如类的继承、方法的重载与重写、多态和封装等。 ... [详细]
  • Iamtryingtomakeaclassthatwillreadatextfileofnamesintoanarray,thenreturnthatarra ... [详细]
  • 在Android开发中,使用Picasso库可以实现对网络图片的等比例缩放。本文介绍了使用Picasso库进行图片缩放的方法,并提供了具体的代码实现。通过获取图片的宽高,计算目标宽度和高度,并创建新图实现等比例缩放。 ... [详细]
  • 本文介绍了使用kotlin实现动画效果的方法,包括上下移动、放大缩小、旋转等功能。通过代码示例演示了如何使用ObjectAnimator和AnimatorSet来实现动画效果,并提供了实现抖动效果的代码。同时还介绍了如何使用translationY和translationX来实现上下和左右移动的效果。最后还提供了一个anim_small.xml文件的代码示例,可以用来实现放大缩小的效果。 ... [详细]
  • HDU 2372 El Dorado(DP)的最长上升子序列长度求解方法
    本文介绍了解决HDU 2372 El Dorado问题的一种动态规划方法,通过循环k的方式求解最长上升子序列的长度。具体实现过程包括初始化dp数组、读取数列、计算最长上升子序列长度等步骤。 ... [详细]
  • 本文讨论了一个关于cuowu类的问题,作者在使用cuowu类时遇到了错误提示和使用AdjustmentListener的问题。文章提供了16个解决方案,并给出了两个可能导致错误的原因。 ... [详细]
  • 拥抱Android Design Support Library新变化(导航视图、悬浮ActionBar)
    转载请注明明桑AndroidAndroid5.0Loollipop作为Android最重要的版本之一,为我们带来了全新的界面风格和设计语言。看起来很受欢迎࿰ ... [详细]
  • 本文详细介绍了Java中vector的使用方法和相关知识,包括vector类的功能、构造方法和使用注意事项。通过使用vector类,可以方便地实现动态数组的功能,并且可以随意插入不同类型的对象,进行查找、插入和删除操作。这篇文章对于需要频繁进行查找、插入和删除操作的情况下,使用vector类是一个很好的选择。 ... [详细]
  • Linux环境变量函数getenv、putenv、setenv和unsetenv详解
    本文详细解释了Linux中的环境变量函数getenv、putenv、setenv和unsetenv的用法和功能。通过使用这些函数,可以获取、设置和删除环境变量的值。同时给出了相应的函数原型、参数说明和返回值。通过示例代码演示了如何使用getenv函数获取环境变量的值,并打印出来。 ... [详细]
  • 本文介绍了Android 7的学习笔记总结,包括最新的移动架构视频、大厂安卓面试真题和项目实战源码讲义。同时还分享了开源的完整内容,并提醒读者在使用FileProvider适配时要注意不同模块的AndroidManfiest.xml中配置的xml文件名必须不同,否则会出现问题。 ... [详细]
  • 先看官方文档TheJavaTutorialshavebeenwrittenforJDK8.Examplesandpracticesdescribedinthispagedontta ... [详细]
  • Android自定义控件绘图篇之Paint函数大汇总
    本文介绍了Android自定义控件绘图篇中的Paint函数大汇总,包括重置画笔、设置颜色、设置透明度、设置样式、设置宽度、设置抗锯齿等功能。通过学习这些函数,可以更好地掌握Paint的用法。 ... [详细]
  • 其实之前也有下载过完整的android源码,但是从来没有对这个做过一些总结,在加上最近需要经常去看,索性就在从新下载,编译一下,其实这些东西官网上面都有。http:sou ... [详细]
  • macOS命令行创建Android模拟器
    macOS下不安装AndroidStudio使用VSCode来开发Flutter应用使用命令行创建和管理Android模拟器设备avdmanageravdmanager 是一种命令 ... [详细]
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社区 版权所有