22

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.

I tried rebooting. No luck.
I tried removing the preferences files for Xcode/IB. No luck.
I tried reinstalling Xcode/IB. Still no luck.

This page explains 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.

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:

[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.

Martin Cote
  • 28,864
  • 15
  • 75
  • 99

6 Answers6

39

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 Project menu in Xcode, or by using the Recent Documents list in the Xcode welcome screen.

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.

Does that help you?

Rob Keniger
  • 45,830
  • 6
  • 101
  • 134
  • 6
    OMG, it works!! It does help me, thanks a bunch! I'm still waiting for a more "scientific" answer though ;) – Martin Cote Oct 15 '09 at 12:42
  • 1
    Glad to help, I'd love to know the cause of this too. – Rob Keniger Oct 15 '09 at 12:50
  • WOW THANKS SO MUCH. I wish I could +100 this answer. I'm not sure if this is the cause of the problem... but I had renamed my project from "ATest" to "Atest" in all the classes, file names, etc. but I did notice that the Open Recent Project menu still showed "ATest" but it opened the right project so I didn't think twice about it until now. – philfreo Dec 10 '09 at 00:02
  • 2
    I believe it's because it opens a different version of xcode. You might want to look into whether this is the case. – Kenneth Ballenegger Mar 24 '10 at 23:24
  • I have the same problem. If I open my own custom IBPlugin then I see this message written to the console. I have tried opening with Finder, both the build version as well as the release version, however the message is still emitted. This didn't help me. There must be a more scientific explanation. – neoneye Jun 26 '10 at 23:42
  • Sweet!! I just wasted an hour on this before finding this thread! :D – Shane Jul 29 '10 at 08:28
  • I cannot even believe this works. Disturbing, to say the least. – Nick Farina Jan 30 '11 at 05:18
  • I have different versions of Xcode running on my machine and I believe this definitely has something to do with it. – Eric Brotto Jun 22 '11 at 12:02
  • My guess is that IB hooks into FSEvents, in order to track updated files from XCode. If the paths are checked on simple equality, then you might expect some problems if the ~/... path or one differing by case is passed into IB. – Jonathan Watmough Aug 11 '11 at 06:55
  • Me too! (Xcode6 and OSX10.10, years after this post was put up). I'm a habitual "open recent..." user too. Fresh .xib wasn't opening from xcode ("no editor")... but opened in interface builder fine from finder. – timday Nov 13 '15 at 21:28
2

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.

It still didn't connect to IB, so then I noticed that the XIB files contain this:

    <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.

Hopefully something in there will help you :-)

Simon Woodside
  • 7,175
  • 5
  • 50
  • 66
1

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.

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.

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).

One other trick I found was that when IB refuses to sync, opening the xib directly via IB's File->Open menu fixes it.

Brent Muir
  • 11
  • 1
1

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.

Rajat Talwar
  • 11,922
  • 1
  • 18
  • 12
1

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.

vreflect
  • 11
  • 1
1

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.

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.

Worked for me. Hope it works for you too! :)

space
  • 11
  • 1