问题
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
回答1:
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.
回答2:
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".
来源:https://stackoverflow.com/questions/13654796/how-to-disable-interface-builder-document-versioning-from-auto-updating