Categories
interface-builder ios iphone xcode4.2 xib

Why is my XIB modified every time I open it in IB?

I click on the XIB via the project navigator. It opens up and immediately changes the icon to gray showing I have unsaved changes. If I save changes, click on a different file and click back to re-open it, more changes. Always modifies on open.

It happens with one XIB file in this project and a couple in another project. I’d love to know why it’s happening and what I can do to fix it now and prevent it in the future.

Note: using Xcode 3.2 Build 4C199 with Snow Leopard

Edit: I’ve added a couple sections which got removed from the XML on one of these open/modifications

        <key>outlets</key>
<dict>
<key>addEventTabBarController</key>
<string>UITabBarController</string>
<key>window</key>
<string>UIWindow</string>
</dict>
<key>superclass</key>
<string>NSObject</string>

and

        <key>outlets</key>
<dict>
<key>courseTableCell</key>
<string>UITableViewCell</string>
</dict>
<key>superclass</key>
<string>UITableViewController</string>

I wound up submitting this issue to Apple. Their response was unenlightening, and talking about possible optimizations, updating meta data for new version of Xcode and the like.

I tracked 100 versions from clicking off and on the file. As Apple said, it was “optimizing” every time, but each time it simply moved some XML tags around. Never happy with it’s own optimizations it moved them around the next time they were opened. I’d consider it a bug with Xcode, annoying, but mostly harmless.

This only happened with old XIBs and either moving the contents into a new XIB file or (what really happened) Storyboards got rid of the issue.