Xcode 显示旧的、已删除的 xib 文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3765989/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 19:46:16  来源:igfitidea点击:

Xcode shows old, deleted xib files

xcodeiosxib

提问by Steve

I've searched all over and haven't found any help...

我已经找遍了,没有找到任何帮助......

I built a small test app with two UIViewControllersand their corresponding xibs.Things were fine, then I made some changes to both xibsbut when I build and run, I get the old views. I've tried deleting the build folders, running in the simulator and device, cleaning all targets and still the same, old, broke-down xibsthat I totally changed are still showing up. I've restarted all the Xcode apps and even my computer.

我构建了一个带有两个的小型测试应用程序,UIViewControllers它们对应的xibs.东西都很好,然后我对两者都做了一些更改,xibs但是当我构建和运行时,我得到了旧视图。我试过删除构建文件夹,在模拟器和设备中运行,清理所有目标,但xibs我完全改变的旧的,故障仍然出现。我已经重新启动了所有的 Xcode 应用程序,甚至我的电脑。

Getting pretty irritated!

变得相当恼火!

EDIT: I never did figure out what the problem was. Basically, once I had built a project, it remembered the first xibs I made and wouldn't recognize changes to them. If I told a view controller to load from a different, valid nib name, it'd complain that the old one wasn't there.

编辑:我从来没有弄清楚问题是什么。基本上,一旦我构建了一个项目,它就会记住我所做的第一个 xibs 并且不会识别对它们的更改。如果我告诉视图控制器从一个不同的、有效的笔尖名称加载,它会抱怨旧的不在那里。

I reinstalled Xcode and now it all works again. Sheesh.

我重新安装了 Xcode,现在它又可以正常工作了。嘘。

采纳答案by Steve

I ended up recreating the xibs from scratch and that worked. Very frustrating.

我最终从头开始重新创建了 xib,并且奏效了。非常令人沮丧。

回答by Graham Perks

Try deleting the app from the simulator (hold down on the app's icon to get to jiggle mode, then click the X by the app) and from your device. Then let Xcode reinstall it.

尝试从模拟器(按住应用程序的图标进入抖动模式,然后单击应用程序旁边的 X)和您的设备中删除该应用程序。然后让Xcode重新安装它。

回答by Alon

just clean the build using

只需使用

Product -> Clean

产品 -> 清洁

menu.

菜单。

回答by James O. Coplien

I just found (and fixed) a related problem — one that demonstrates similar symptoms but whose root cause is slightly different.

我刚刚发现(并修复了)一个相关问题——一个表现出相似症状但根本原因略有不同的问题。

In particular, the symptoms I observed were that my iPad app would initially display an old storyboard image for the first page and, after a short delay, would bring up the most recently edited story board contents. I went through most of the above machinations to no avail.

特别是,我观察到的症状是,我的 iPad 应用程序最初会显示第一页的旧故事板图像,并在短暂延迟后显示最近编辑的故事板内容。我经历了上述大部分阴谋都无济于事。

The problem is that the iPad loader first just dumbly loads your app's launch image into the screen. You usually set up this image as part of the early administrative setup of the app in XCode. At launch time, while the end user is considering the content and cogitating about where to touch the screen, the application is in the mean time madly getting itself ready, un-archiving the xib/nib/storyboard, and doing the realwork of getting ready.

问题是 iPad 加载器首先只是傻傻地将应用程序的启动图像加载到屏幕中。您通常将此图像设置为 XCode 中应用程序早期管理设置的一部分。在启动时,当最终用户正在考虑内容并考虑触摸屏幕的位置时,应用程序同时疯狂地准备自己,取消归档 xib/nib/storyboard,并做真正的工作准备好。

In the ideal situation the provided launch image is pixel-for-pixel the same as the one generated by the nib-unarchiving-process. However, if you forgot to update your launch image after updating the story board, you'll see an image shift at the completion of the unarchiving.

在理想情况下,提供的启动图像与 nib-unarchiving-process 生成的图像逐像素相同。但是,如果您在更新故事板后忘记更新您的启动图像,您会在解压完成时看到图像偏移。

I wouldn't have suspected this as the problem except that I had read Jef Raskin's description of how he did exactly this on the Canon Cat word processor to provide the illusion of an instantly ready application: it takes advantage of the fact that the typical human response time to an application startup is on the order of seven seconds — plenty of time for even a floppy-based system to load and overwrite the bitmap facade that the loader sets up. Sometimes, it's good to have read a bit of arcane history. Jef would of course later go on to found a project whose name was Macintosh, and the rest is history — and this bug.

我不会怀疑这是问题所在,除非我已经阅读了 Jef Raskin 关于他如何在 Canon Cat 文字处理器上完全做到这一点的描述,以提供一个立即准备好的应用程序的错觉:它利用了一个事实,即典型的人类应用程序启动的响应时间约为 7 秒——即使是基于软盘的系统也有足够的时间来加载和覆盖加载程序设置的位图外观。有时,阅读一些神秘的历史是件好事。Jef 后来当然会继续创建一个名为 Macintosh 的项目,剩下的就是历史——还有这个 bug。

回答by Sirius

Just modify your XIB files a bit, then save them, xCode will detect a modification (last modified date in the file system) then load the xib from its actual path, and not from a cache-path :P

只需稍微修改您的 XIB 文件,然后保存它们,xCode 将检测修改(文件系统中的最后修改日期),然后从其实际路径加载 xib,而不是从缓存路径:P

回答by PowerAktar

I know steve has found a work around but the problem is not in the XIB files at all. Xcode does not update the YouApplication-info.plist file to

我知道史蒂夫已经找到了解决方法,但问题根本不在 XIB 文件中。Xcode 不会将 YouApplication-info.plist 文件更新为

If you open it up you will see the line: Main nib file base name. You must change the value to reflect your desired NIB file name

如果你打开它,你会看到一行:Main nib file base name。您必须更改该值以反映所需的 NIB 文件名

回答by johna

I had this problem, and it was a result of xcode continuing to copy previously compiled xib's - even though the source file was deleted, the build cache wasn't. Product > Clean and then recompiling solved it.

我遇到了这个问题,这是 xcode 继续复制以前编译的 xib 的结果 - 即使源文件被删除,构建缓存也没有。产品>清理然后重新编译解决了它。

回答by Jim Hall

I just had this issue, just delete the app from the simulator.
Then do a clean on your project.
In xCode, go to the Product menu, select Clean.

我刚刚遇到了这个问题,只需从模拟器中删除该应用程序即可。
然后对您的项目进行清理。
在 xCode 中,转到“产品”菜单,选择“清洁”。

Or just press Shift+Command+K!

或者只需按 Shift+Command+K!

回答by Jim Hall

Not sure whether this helps, but I just had this.

不确定这是否有帮助,但我刚刚有了这个。

It took me days to work it out. In my case I enhanced an existing Xib file. The changes I applied in interface builder never appeared in the app.

我花了几天时间才搞定。就我而言,我增强了现有的 Xib 文件。我在界面构建器中应用的更改从未出现在应用程序中。

Eventually I found the cause. I had my FilesOwner view outlet set to a subview below the top view. When I enhanced the view I did this as an extension to th top view. Thus the changes never appeared when running the app.

最后我找到了原因。我将我的 FilesOwner 视图插座设置为顶视图下方的子视图。当我增强视图时,我将其作为对顶视图的扩展。因此,运行应用程序时从未出现更改。

Changing the view outlet to the correct view ( the top view in my case ) did the trick and it all worked fine ...

将视图出口更改为正确的视图(在我的情况下为顶视图)可以解决问题,并且一切正常......

回答by domsom

Just an assumption, not sure if that really caused it: I finished a XIB that worked fine in the simulator and on an actual device. I then changed it to be localised in Xcode 4.5.1. The changes I did after that were not synced to the device until I manually deleted the app from the device and reinstalled via Xcode.

只是一个假设,不确定这是否真的导致了它:我完成了一个在模拟器和实际设备上运行良好的 XIB。然后我将其更改为在 Xcode 4.5.1 中本地化。在我从设备中手动删除应用程序并通过 Xcode 重新安装之前,我之后所做的更改不会同步到设备。

回答by Iris Veriris

Deleted derived data, cleaned project and build. Old xib was magically removed. :D

删除派生数据,清理项目并构建。旧的xib被神奇地移除了。:D