38

This question is still getting a lot of upvotes. So look at Update3. once you have upvoted, commented, answered, please please please file a radar

Viewing a nib / xib, modifies the file, forcing me to either commit the change or undo the change. This is not an issue, until there are merge conflicts.

Detail: I work in a team of 5 iOS developers, and the last few versions of XCode, we are experiencing an issue with the .xib / nib files getting touched / modified when anyone opens the file (without making any changes).

If one developer thinks "screw it, let me checkin whatever modifications xcode does" and checks it in, it doesn't stop there. the same file on two different machines (with the same version of XCode and MacOS) will again be touched/modified when another developer views that nib.

The thing that usually gets modified in the .xib file is this

    <key>com.apple.ibtool.document.version-history</key>
<dict>
    <key>interface-builder-version</key>
    <dict>
        <key>com.apple.InterfaceBuilderKit</key>
        <string>2844</string>
        <key>macosx.version</key>
        <string>12C60</string>
    </dict>
</dict>
<key>com.apple.ibtool.document.warnings</key>
<dict/>

But other than that it also modifies or moves around existing key-value pairs within the .xib file.

I have searched a lot on SO and Google, and I haven't seen many posts about this issue.

I had a nightmare of a merge conflicts when I upgraded all nibs to handle the iPhone5 screen, which in itself wasn't too complicated, but got a ton of merge conflicts due to the document versioning.

Deleting code I didn't understand, led to xcode crashing when I tried opening the nib. (I have fixed this for now, by reverting to what it was earlier)

Any advice on how to avoid this issue, is appreciated!

Update: Have noticed that this is not resolved yet, and still getting upvotes quite often. I am just curious, do any of the storyboard projects experience the same issue? (I haven't worked on storyboards yet).

Update2: To all those who are experiencing the same issue, please file a Radar even if you get a response saying there is an existing radar. it helps bubble the issue to the top and the gods of XCode will address it only then.

Update3: I still see quite a few upvotes on this thread, and the apple bug report is still open. So, after upvoting this question, please file a radar, with details I have mentioned in the question (and/or add your own explanation)

Update4: This question is still getting a lot of upvotes. So look at Update3. once you have upvoted, commented, answered, please please please file a radar

Update5: Per info from Apple Engineers at WWDC 2014, this issue has been fixed in Xcode6. I'll update this question (and probably close it) once I confirm that this has been fixed.

Update6: Hoping to see this fixed. Will be asking this at WWDC2015 (through someone I know who's going there). Would be great if the other lucky ones who got a WWDC ticket can also do the same at WWDC 2015

Update7: Xcode 7 is here, and so is this bug :( The original radar report (11533872) is still open

Nitin Alabur
  • 5,812
  • 1
  • 34
  • 52
  • We run into this issue on our team as well. We use Git for our source control. We have started using Xcode's visual commit feature. This at least shows us all files that we are committing that have a modification. Sometimes this might include a xib file that we had touched (but not actually modified), and so we just uncheck it from the commit. – Adam Johnson Nov 30 '12 at 23:53
  • Thanks for the comment Adam! Even we are using Git for source control. I doubt it has anything to do with what kind of source control is used. Its just that the Xcode messes it up every time. So if I did touch a bunch of nibs by making some changes, and a few nibs by mistake (just by viewing the nibs), I'd have a hard time to figure which ones to uncheck from the commit :-/ – Nitin Alabur Dec 02 '12 at 18:03
  • The simplest fix is to make all your developers run the same version of Xcode. Why can't you do that? – rob mayoff Dec 02 '12 at 18:45
  • 1
    As i said in the OP, everyone is running the same version of XCode, and are on the same OS, still edits the nib file when the nib is viewed. Of course, in this case, it doesn't mark the file as modified, but still its annoying. For now, I have hard set the deployment target to XCode 4.5 and development target to Interface Builder 3.2. (I think setting it to project SDK and Previous version would mess it up, based on what versions others had) – Nitin Alabur Dec 02 '12 at 19:44
  • still, I think its a bug in XCode. will file a radar soon. – Nitin Alabur Dec 02 '12 at 19:59
  • 2
    Filed a report on radar. got a reply saying that its a dupe of Bug ID# 11533872. Hoping to see this fixed! – Nitin Alabur Dec 08 '12 at 01:05
  • Thanks for that note about the report being a dupe, that's VERY useful! ... although I have to figure out how to find that bug report now. – Tom Pace Jan 30 '13 at 18:36
  • I posted another question, it's actually mostly a duplicate of this issue. Your question came up in the Related questions. I'm glad you posted. – Tom Pace Jan 30 '13 at 18:39
  • glad it helped! The process of finding reported bugs on the radar is irritating. I just go ahead and file it. I think the number of dupes bubbles up the ranking of the bug in the radar – Nitin Alabur Jan 30 '13 at 20:28
  • Same problem with storyboard, but the xml is way more clean and understandable :) – Antzi May 08 '13 at 09:28
  • thanks for that comment Antzi! That certainly makes me less worried to use Storyboards :) – Nitin Alabur May 08 '13 at 16:44

2 Answers2

2

Version 4.6.3 of Xcode resolves this issue. However, as the comments state, you all need to be running that same version. If four developers are on 4.6.3, and one is on a previous version, then that developer will experience the same issue. However, if they do not commit that change then it will not affect the others.

The two Xib keys affected are:

<string key="IBDocument.AppKitVersion">1187.39</string>
<string key="IBDocument.SystemVersion">12E55</string>

So, bottom line, get everyone on the team to update to Xcode 4.6.3.

Max MacLeod
  • 26,115
  • 13
  • 104
  • 132
  • I still experience this in storyboards on 4.6.3 – kball Jul 12 '13 at 04:26
  • yes, you will if you open a Xib that has been opened by a version of Xcode earlier than 4.6.3. That's why everyone on your team needs to be on the same version. – Max MacLeod Jul 12 '13 at 07:33
  • 2
    This bug still exists on XCode 5.0! And yes, even on Storyboards..where it is more of a pain. – codeburn Oct 07 '13 at 12:55
1

Try updating the XIB's "Document Versioning: Development" setting:

Xcode: File Inspector: Interface Builder Document: Document Versioning: Development

to at least "Interface Builder 3.1".

WPK
  • 13
  • 2
  • thanks for the answer. But, as I have mentioned in the comments to my question, I have hard set it to 3.2, and still see the issue. It doesn't matter if you set it to a specific version, or let it set to the latest version of document versioning, the bug still exists. – Nitin Alabur Feb 26 '13 at 19:14
  • 1
    Sorry, new here. You are right. Setting that seemed to have helped my project for a while, and then it happened again... to some XIBs; seemingly random this time. – WPK Mar 01 '13 at 15:11