8

I know many of you have experienced the same the scenario, where you are banging your head against the wall wondering what is wrong with your app only to find that you have forgotten to save your Interface Builder changes.

Well, this never happens to me, because for some reason Xcode will prompt me to save any changes in Interface Builder whenever I build. A coworker and I are trying to figure out how to change this on his machine, with no success. I must have done something in the very early stages of my iphone development life to configure this.

Does anyone know how to link IB with Xcode so that it will prompt to save changes to IB files during a build?

Abizern
  • 146,289
  • 39
  • 203
  • 257
Tony Eichelberger
  • 7,044
  • 7
  • 37
  • 46

8 Answers8

3

Someone else asked pretty much the same question (link from @balanon). The answer by irsk:

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.

Here's my original answer:

Do you both have the same version of Xcode? I note that since I moved to Snow Leopard and Xcode 3.2 the link between Xcode and Interface Builder is not as robust as it was with earlier versions. This seems fairly widespread -- I've seen quite a few complains on Twitter at least -- and so hope that Apple fix this.

Community
  • 1
  • 1
Stephen Darlington
  • 51,577
  • 12
  • 107
  • 152
  • That may be the case with snow leopard, but I was in an iPhone class last year and I was the only one in the class that had xcode and IB integration working. We were all on the same version of xcode and the same version of Leopard. The instructor did not know why mine was working and nobody else's was. – Tony Eichelberger Oct 15 '09 at 18:05
  • I'm on Snow Leopard with Xcode 3.2.2, and this solution didn't work for me. I tried using both the Apple menu and Finder. – Senseful Mar 21 '10 at 04:38
2

Are you perhaps running 32 bit while he is running 64 bit?

I seem to recall an issue with IB's AppleEvent-based communication with Xcode in 64 bit.

Ken
  • 12,933
  • 4
  • 29
  • 32
1

Not sure but do you have the most recent versions of Apple's development environments installed? Mine was preset.

vinnybad
  • 2,102
  • 3
  • 19
  • 29
1

Maybe the setting is not getting propagated properly through an install or upgrade. Have you tried toggling the "For Unsaved Files" setting on an off? (XCode -> Preferences -> Building)

blueberryfields
  • 45,910
  • 28
  • 89
  • 168
1

Prior to SnowLeopard, IB used to automatically save my changes when I built. Now I have to manually save or else it doesn't use my latest changes. In addition, IB does not maintain or update its "Open Recent" File menu (it's empty). Check with your buddy to see if he's on SnowLeopard with Xcode 3.2.

mahboudz
  • 39,196
  • 16
  • 97
  • 124
1

I think it's related to xCode prefrences.

See "xCode" -> "Preferences" -> "Building" -> "For unsaved files" -> option

Pavel Yakimenko
  • 3,234
  • 4
  • 28
  • 33
  • Yes, this would be the obvious place to start, unfortunately, we both have that set to prompt to save before building. It problem lies in the Interface Builder integration somewhere. – Tony Eichelberger Oct 16 '09 at 12:51
1

This used to work flawlessly for me, too, but stopped working with Xcode 3.0. I'm sure there must be some hidden setting since it works for some, presumably those that had it activated in Xcode 2.x, however I haven't found it.

For those interested, I have a workaround that involves calling a simple AppleScript which saves all open IB documents. Here are the steps:

1) Create the Apple Script, something along these lines:

tell application "Interface Builder"
 set num to count of documents
 if num > 0 then
  repeat with i from 1 to num
   tell document i to save
  end repeat
 end if
end tell

2) Save it as Script (in my example /Users/myself/Programming/SaveIBFiles.scpt)

3) In your project, create a new Target. That is menu "Project" » "New Target...", there choose "Other" » "Shell Script Target". I named it "Save IB Files"

4) Expand the new target, it already contains a "Run Script" phase. Call up the info for this Run Script phase, "General" tab, leave Shell at /bin/sh and as Script write:

if [ -f "/Users/myself/Programming/SaveIBFiles.scpt" ]; then
 osascript "/Users/myself/Programming/SaveIBFiles.scpt"
fi

5) Now select your original target, call up its info, "General" tab, and add the new target as a direct dependency.

Now, whenever you build your app, the script gets called, saves your open IB files and then compiles your main target. Note that if you don't create a new target and merely add a "Run Script" build phase to your main target, the saving seems to occur too late.

Hope this helps!

Pascal
  • 16,846
  • 4
  • 60
  • 69
1

Try opening your xcode project from the finder window. After I upgraded to snow leopard the link between xcode and IB broke if the project is loaded from the Recent Files option.

This answer may be related Interface Builder and Xcode integration not working

Community
  • 1
  • 1