HyWhen trying to refactor storyboard, it seems I have accidentally broken local git. Now it didn’t show a “current” branch anymore. All the branches I have are still there. I can also branch from existing branches, but I can’t make new commit. There’s no “A” or “M” when I made changes to code. There is still the blue lines indicating where you made changes in code files. What do I need to do to get got to work?
Here’s how I come to this situation:
I tried to refactor Main.storyboard. Selected a few Controllers, Editor->Refactor to Storyboard
I didn’t check at the time, but I believe the “Where” was set to “Base.Iproj” by default.
The new storyboard ended up not in the right place. Since I can’t “undo” this refactoring, I deleted it.
Committed the two code files I modified, deselected the storyboards and another file I didn’t remember the name of and hit commit. Then I discarded all changes from “Source Control” menu.
This break the code. Build failed.
So I checked out the newly committed one, didn’t work.
I checked out the one before. This time the build was successful. However, git stopped working like I described above. No “current” on any branch, and when tried to commit, it didn’t show any error. It simply didn’t have any effect.
However, when I tried to commit, the refactored storyboard that I have deleted showed up in the selection window with a checkbox, inside that base.Iproj folder. But I have go into my project folder and checked, there is no such file in that folder.
This is really not code related and all I did that broke git was listed above. I wonder what I have done so wrong that git is rewarding me with this maddening malfunction but more importantly, I need the local repository to work. Appreciate any help.
I’m using Xcode 10.2. I have tried restarting the Mac, XCode, and the project. None worked.
I've been working on a project the last few weeks in Xcode and everything's been great. Main.Storyboard all of a sudden, will not load or open. Other projects open fine. There hasn't been any significant changes in this project. The last thing I tried doing was adding a navigation bar to one of my view controllers, to add buttons or items. I also tried adding a navigation item. Things started to complicate after trying to do these things. I have the latest version of Xcode, my project settings are linked correctly and tried rebooting my Mac but it doesn't solve anything. Does anybody know what may have caused this error and how to resolve?
The easy way:
Check out the latest working version of the storyboard file and try the changes again. Likely something odd and transient happened that corrupted the existing storyboard file (I've seen it happen with managed object model files before which are also XML underneath).
If there are too many changes to redo them:
Make a copy of the current storyboard file outside the repo and then checkout the latest working version of the file from the repo.
Diff the two files moving over changes that make sense from the troublesome file keeping an eye out for balanced tags (i.e. if a view has an opening tag but no closing tag Xcode will get confused).
Try opening the modified storyboard in Xcode. With luck it will open and be fine. Otherwise you will need to do a bit more digging or go back to option one and redo the changes.
I downloaded your repo and I can open Main.storyboard just fine:
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.
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".
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