Preventing XCode from auto-versioning files - xcode

This is a general XCode question but here goes.
When a nib is opened, XCode auto-versions it, causing it to appear as a changed file in Git/SourceTree. This occurs regardless of whether any real changes have occurred in the nib. The behavior occurs in other file types as well, like image asset catalogs.
When working in a large app with many nibs or large asset catalogs, opening/closing without changes can result in a large list of changed files and increase the chances of unintentionally staging and committing, etc.
Does anyone know of a way to prevent XCode from auto-versioning? Thanks!

In the preferences, uncheck "Add and remove files automatically".

Related

Xcode 7.3 auto-updates IB files, clusters git

I have an Xcode project with, of course, nib files and storyboards. It seems like since I have upgraded to Xcode 7.3, the nibs and storyboards keep automatically updating themselves, thus marking them as modified by git.
This behavior used to happen only when opening the file: Xcode would then update some metadata. But now it seems to keep updating itself even if Xcode is not the active app. More specifically, I can be in Terminal, type > git status and have the expected result of > Your branch is up-to-date. Then, a few seconds later, run > git status again and have myStoryboard.storybardas a modified file. Xcode was never active during that period.
How can I avoid this behavior? Is it something new in Xcode 7.3?
Thank you in advance.
My guess is that this behind-the-scenes auto-modification is exactly to prevent the annoying feature where opening the storyboard file modifies it (and marks it as "dirty"). This way, the storyboard file is already modified (and saved) before you get around to opening it.
All of this has something to do with coordinating between the storyboard and your code, which is a long-standing problem that goes all the way back to the days when Xcode and Interface Builder were two completely separate applications that knew nothing of one another. Xcode today is a forced meld between these two applications, and tries to do all kinds of cute things behind the scenes so that they do know something about one another. What you're seeing is, I'm betting, a consequence of this.

Editing storyboard in Xcode 5 is very slow

I have Xcode 5 and storyboard editing is very slow. Each time I start Xcode I get the message:
"The document "MainStoryboard.storyboard" had 26 internal inconsistencies that were found and repaired."
and
"Multiple resources have the same name: yellowbutton.png, etc.
The preceding issues may have occurred due to an SCM operation such as merging."
Standard solutions as deleting the workspace file did not help. How can I solve this?
Thanks!
I had a similar result when I added a segmented control inside a uitoolbar. It would crawl but only when Xcode was on my external monitor. What did the trick, oddly enough, is making sure the segment control style is set to Bar.
I had the same issue. Whenever I opened the storyboard after the inconsistencies message was displayed, Xcode would consume 60%+ CPU and essentially make it unusable.
I (very slowly) found which images were being reported as problems, then deleted them through finder and restarted Xcode. You may also need to remove any references to these images in the storyboard.
Xcode now runs fine - hope it helps!
Try removing all the layout constraints on the view. Storyboard was unusable due to performance until I did this. I'm trying to learn constraints and must have totally jacked them up.
Its under Editor - Resolve AutoLayout Issues - Clear All Constraints in View Controller"
The thing that finally fixed it for me was to disable snapshots in each of the projects that was having performance problems.
File > Project Settings > Snapshots
Once I had disabled the snapshots, I also nuked all the snapshots. The total disk usage in my snapshots directory in a fairly short period of time was ~3GB.
The default directory for the snapshots to be stored in is :~/Library/Developer/Xcode/Snapshots.
Keep in mind that the snapshot setting is set for each project, so you will need to do this for each every project that you are having the performance issues.

Any explanation for wrong images showing up?

Some background. Until I redo this part of the app, for now, I've dragged a bunch of images into my project. They are called Landscapexx.jpg and Portraitxx.jpg, where xx is a number from 0 to the total number of pictures (minus one) for that orientation.
At some point, I replaced the images used in the project. But the original images are still showing up on my device (but not in Xcode). Using NSLog to confirm which image is being loaded, I then look up the image with the same name in Xcode. Sometimes it's the same image. Sometimes it's not.
At first I thought the problem was that when building the app again the data remained. That would be a reasonable explanation. However, when I deleted the app, acknowledging that the data would be deleted, that did not solve the problem. Could this be a cache issue? If so, how do I clear the relevant cache?
One last thing. The images that appear incorrectly on the iPad have the project name checked in the file inspector.
The way I'm loading the images, by the way is using NSString *newImageName = [NSString stringWithFormat:#"Landscape%d.jpg",n];, for example. So the file simply needs to be in my project space somewhere, I thought. If there are two copies, I have no idea where the second one would be. I don't see them in Xcode.
P.S. If I run the app in the simulator, I get the same images as on Xcode. This suggests the errant images are cached somewhere in my iPad. Since deleting the app didn't take care of the problem, is there something else I can try?
EDIT: I found something that may point to an issue. If I go to the Build Phases screen and open the Copy Bundle Resources item, all the images are listed there. However some of them don't have the ...in projectname after them. These same items have the project checked in the file inspector. Not all the images are this way. What do I need to do to ensure all the files are correctly in the project?
I suggest deleting the app from the phone, cleaning the project, and rebuilding the app. This happens to me on occasion and this usually fixes it.
I figured it out. Going through all the menu options in Xcode, I found an option called Clean in the Product menu. I selected it, rebuilt the app and all is fine now. This option apparently clears out the precompiled stuff that occurs the first time a project is built.

Nuking off the xib cache

Due to an ugly series of code sign problems, I decided to import the new files into a previous version of my app retrieved from the backup. At last all went fine and good but for the main controller xib file that keeps on presenting the original layout, notwithstanding I have inserted the localized new ones. I also tried to removed the localized ones but it does not care at all: in all my system I have no xib of that shape and so I think it keep some weird cache somewhere tab it uses not finding a non localized xib. Following this idea I also tried to remove the localization from the Xib files but they still remain in they language folder.
I tried deleting the derived data many times as well as cleaning the build to no avail. What other directory could I delete to get rid of those xib preprocessed files?

Xcode shows old, deleted xib files

I've searched all over and haven't found any help...
I built a small test app with two UIViewControllers and their corresponding xibs. Things were fine, then I made some changes to both xibs but when I build and run, I get the old views. I've tried deleting the build folders, running in the simulator and device, cleaning all targets and still the same, old, broke-down xibs that I totally changed are still showing up. I've restarted all the Xcode apps and even my computer.
Getting pretty irritated!
EDIT: I never did figure out what the problem was. Basically, once I had built a project, it remembered the first xibs I made and wouldn't recognize changes to them. If I told a view controller to load from a different, valid nib name, it'd complain that the old one wasn't there.
I reinstalled Xcode and now it all works again. Sheesh.
Try deleting the app from the simulator (hold down on the app's icon to get to jiggle mode, then click the X by the app) and from your device. Then let Xcode reinstall it.
just clean the build using
Product -> Clean
menu.
Just modify your XIB files a bit, then save them, xCode will detect a modification (last modified date in the file system) then load the xib from its actual path, and not from a cache-path :P
I just found (and fixed) a related problem — one that demonstrates similar symptoms but whose root cause is slightly different.
In particular, the symptoms I observed were that my iPad app would initially display an old storyboard image for the first page and, after a short delay, would bring up the most recently edited story board contents. I went through most of the above machinations to no avail.
The problem is that the iPad loader first just dumbly loads your app's launch image into the screen. You usually set up this image as part of the early administrative setup of the app in XCode. At launch time, while the end user is considering the content and cogitating about where to touch the screen, the application is in the mean time madly getting itself ready, un-archiving the xib/nib/storyboard, and doing the real work of getting ready.
In the ideal situation the provided launch image is pixel-for-pixel the same as the one generated by the nib-unarchiving-process. However, if you forgot to update your launch image after updating the story board, you'll see an image shift at the completion of the unarchiving.
I wouldn't have suspected this as the problem except that I had read Jef Raskin's description of how he did exactly this on the Canon Cat word processor to provide the illusion of an instantly ready application: it takes advantage of the fact that the typical human response time to an application startup is on the order of seven seconds — plenty of time for even a floppy-based system to load and overwrite the bitmap facade that the loader sets up. Sometimes, it's good to have read a bit of arcane history. Jef would of course later go on to found a project whose name was Macintosh, and the rest is history — and this bug.
Not sure whether this helps, but I just had this.
It took me days to work it out. In my case I enhanced an existing Xib file. The changes I applied in interface builder never appeared in the app.
Eventually I found the cause. I had my FilesOwner view outlet set to a subview below the top view. When I enhanced the view I did this as an extension to th top view. Thus the changes never appeared when running the app.
Changing the view outlet to the correct view ( the top view in my case ) did the trick and it all worked fine ...
I know steve has found a work around but the problem is not in the XIB files at all. Xcode does not update the YouApplication-info.plist file to
If you open it up you will see the line: Main nib file base name. You must change the value to reflect your desired NIB file name
I had this problem, and it was a result of xcode continuing to copy previously compiled xib's - even though the source file was deleted, the build cache wasn't. Product > Clean and then recompiling solved it.
I just had this issue, just delete the app from the simulator.
Then do a clean on your project.
In xCode,
go to the Product menu,
select Clean.
Or just press Shift+Command+K!
I ended up recreating the xibs from scratch and that worked. Very frustrating.
you can try to modify your XIBs a bit, so xCode will detect a modification through the last modified date in file system. then it will load the xib from its actual path, an not from xCode cache.
I had the same problem, but i solved it by changing the datetime of my system to today. And re-saved the xib. I was testing the local notification.
Just an assumption, not sure if that really caused it: I finished a XIB that worked fine in the simulator and on an actual device. I then changed it to be localised in Xcode 4.5.1. The changes I did after that were not synced to the device until I manually deleted the app from the device and reinstalled via Xcode.
Deleted derived data, cleaned project and build. Old xib was magically removed. :D

Resources