Interface Builder 和 Xcode 集成不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1568930/
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
Interface Builder and Xcode integration not working
提问by Martin Cote
After having installed the iPhone SDK 3.1.2, Interface Builder is not in sync with Xcode anymore. The light indicator at the bottom of the XIB window is grey. IB doesn't see any files from the Xcode project. Xcode is always open when I start IB.
安装 iPhone SDK 3.1.2 后,Interface Builder 不再与 Xcode 同步。XIB 窗口底部的指示灯为灰色。IB 没有看到来自 Xcode 项目的任何文件。当我启动 IB 时,Xcode 始终处于打开状态。
I tried rebooting. No luck.
I tried removing the preferences files for Xcode/IB. No luck.
I tried reinstalling Xcode/IB. Still no luck.
我尝试重新启动。没运气。
我尝试删除 Xcode/IB 的首选项文件。没运气。
我尝试重新安装 Xcode/IB。仍然没有运气。
This pageexplains how IB monitors the changes in Xcode. While it was an interesting read, it didn't provide any help about how to investigate my problem.
本页解释了 IB 如何监控 Xcode 中的变化。虽然这是一个有趣的阅读,但它没有提供有关如何调查我的问题的任何帮助。
Any help would be appreciated.
任何帮助,将不胜感激。
EDIT
Here's additional information. I enabled the debug logs for launchd, and I noticed the following line that appears every time Interface Builder is started:
编辑
这是附加信息。我为launchd启用了调试日志,我注意到每次启动Interface Builder时都会出现以下行:
[0x0-0x1b01b].com.apple.InterfaceBuilder3[315]: Couldn't open shared capabilities memory GSCapabilities (No such file or directory)
This really seems to be related to my issue.
这似乎真的与我的问题有关。
回答by Rob Keniger
I have been having the same problem and it's been driving me nuts.
我一直有同样的问题,它一直让我发疯。
Bizarrely, it seems to be caused by opening your project using the File > Open Recent Projectmenu in Xcode, or by using the Recent Documents list in the Xcode welcome screen.
奇怪的是,这似乎是由于使用Xcode 中的文件 > 打开最近的项目菜单打开您的项目,或使用 Xcode 欢迎屏幕中的最近文档列表造成的。
If I double-click the project file in the Finder to open it or choose the project from the Recent Items menu in the Apple menu, Xcode's connection to Interface Builder is intact.
如果我在 Finder 中双击项目文件将其打开或从 Apple 菜单的“最近的项目”菜单中选择项目,则 Xcode 与 Interface Builder 的连接完好无损。
Does that help you?
这对你有帮助吗?
回答by Simon Woodside
I had this problem just now because I renamed my project from Project.xcodeproj
to project.xcodeproj
in the finder. I wanted to keep the new lowercase name so I opened the project.pbxproj file in a text editor and manually lowercased everything there too.
我刚才有这个问题,因为我改名为我的项目来自Project.xcodeproj
于project.xcodeproj
在取景器。我想保留新的小写名称,所以我在文本编辑器中打开了 project.pbxproj 文件,并手动将所有内容也小写。
It still didn't connect to IB, so then I noticed that the XIB files contain this:
它仍然没有连接到 IB,所以我注意到 XIB 文件包含以下内容:
<string key="IBDocument.LastKnownRelativeProjectPath">../../Project.xcodeproj</string>
So I changed that to:
所以我把它改成:
<string key="IBDocument.LastKnownRelativeProjectPath">../../project.xcodeproj</string>
That didn't fix it either!
那也没有解决!
Finally, I noticed that the path for the group (folder on the left panel of XCode) that contain my nibs was messed up. So, I opened the project again in my editor and fixed those, and finally it was fixed.
最后,我注意到包含我的笔尖的组(XCode 左侧面板上的文件夹)的路径搞砸了。所以,我在我的编辑器中再次打开了这个项目并修复了这些,最后它被修复了。
Hopefully something in there will help you :-)
希望里面的东西会帮助你:-)
回答by Brent Muir
This was driving me nuts for a couple hours today. Opening the project from Finder did the trick for me, but I haven't found an explanation for why this trick works. So I poked around a bit and I suspect it has something to do with tilde expansion. If I create a new project outside of my home folder, Xcode and IB have no problems.
这让我今天疯狂了几个小时。从 Finder 打开项目对我有用,但我还没有找到解释为什么这个技巧有效。所以我仔细研究了一下,我怀疑它与波浪号扩展有关。如果我在我的主文件夹之外创建一个新项目,Xcode 和 IB 没有问题。
This is what I've noticed: when I create a new project and save it anywhere under my own home folder (e.g. Documents), the path listed under the project in the "Welcome to Xcode" screen is "~/Documents". If I clear the "Open Recent Project" menu and then open the project via Finder, the project path is then shown as "/users/[username]/Documents". At this point, Xcode and IB work fine even if the project is opened via the Recent Projects list.
这是我注意到的:当我创建一个新项目并将其保存在我自己的主文件夹(例如 Documents)下的任何位置时,“Welcome to Xcode”屏幕中项目下列出的路径是“~/Documents”。如果我清除“打开最近的项目”菜单,然后通过 Finder 打开项目,则项目路径将显示为“/users/[username]/Documents”。此时,即使项目是通过“最近的项目”列表打开的,Xcode 和 IB 也能正常工作。
I suspect the Xcode<->IB sync is getting confused by the tilde and the reason it works fine when opened via Finder is that the path is expanded before being passed to Xcode (and then to IB).
我怀疑 Xcode<->IB 同步被波浪号弄糊涂了,它在通过 Finder 打开时工作正常的原因是路径在传递给 Xcode(然后传递给 IB)之前被扩展。
One other trick I found was that when IB refuses to sync, opening the xib directly via IB's File->Open menu fixes it.
我发现的另一个技巧是,当 IB 拒绝同步时,通过 IB 的 File->Open 菜单直接打开 xib 可以修复它。
回答by Rajat Talwar
i tried all the above options , but nothing worked , I then removed and reinstalled xcode ,still nothin worked, I then installed xcode to a different location, now the things are working fine.
我尝试了上述所有选项,但没有任何效果,然后我删除并重新安装了 xcode,仍然没有任何效果,然后我将 xcode 安装到不同的位置,现在一切正常。
回答by vreflect
I changed my file type association in XCode preferences under the File Types section. I changed the file.xib setting to External Editor and selected "Other" the located my Interface Builder in ./Developer/Applications or wherever you installed you XCode to.
我在文件类型部分下的 XCode 首选项中更改了我的文件类型关联。我将 file.xib 设置更改为外部编辑器,并在 ./Developer/Applications 或您安装 XCode 的任何位置选择了位于我的 Interface Builder 的“其他”。
回答by space
Had the same problem .xib files not opening Interface Builder. Fixed by giong into Xcode, load your project up, right-click on your xxxx.xib file, doing to PREFERENCES at the bottom, then GENERAL PREFERENCES, then go to FILE TYPES across the top.
有同样的问题 .xib 文件无法打开 Interface Builder。通过 giong 进入 Xcode 修复,加载你的项目,右键单击你的 xxxx.xib 文件,在底部做 PREFERENCES,然后是 GENERAL PREFERENCES,然后转到顶部的 FILE TYPES。
Then change the editor for .xib file types to something else e.g. Textwrangler - then APPLY, then, open up the xxxx.xib file in Textwrangler (or whatever) by double-clicking on it; then go back and change the editor to Interface Builder and APPLY.
然后将 .xib 文件类型的编辑器更改为其他内容,例如 Textwrangler - 然后应用,然后双击在 Textwrangler(或其他)中打开 xxxx.xib 文件;然后返回并将编辑器更改为 Interface Builder 并应用。
Worked for me. Hope it works for you too! :)
对我来说有效。希望它也适用于您!:)