I have read the First Book from appcoda "Beginning programming with Swift"
One feature that I learned in said book and that I really liked while working with storyboards is the ability to refactor some storyboards when the amount of storyboards becomes too large, so at first I was doing it successfully, no problem whatsoever.
I began dividing my storyboards into smaller chunks like so
OH THE HORROR
then this happened
As soon as I pressed "refactor to storyboards" it didn't prompt me for a name as it did before but instead it renamed the new storyboard reference to "Main copy.storyboard"
Can I recover the storyboard that I lost?
When that happened, the old storyboard dissapeared and an exact copy of the main.storyboard appeared
CTROL-Z Did not work as I tried that immediately and I haven't versioned for the past 2 days or so (I know, that was really stupid)
If I can not recover the storyboard, can someone tell me why did this happen? I don't want to do this again
Btw, I am running the last version of XCode 7.2.1
Xcode may have put the lost storyboard in the Trash. Use the Finder to check. The Trash is the wastebasket-looking thing at the right or bottom end of the Dock.
If the lost file is in the Trash, you may be able to right-click it and choose “Put Back” to send it back into your project folder. You may also need to add it back to your project in Xcode using File > Add Files to “MyProject”.
I got in to the same problem. If you accidentally replaced the original storyboard with new one while refactoring, you can find the old one in project folder with a name ending with "~" symbol.
Hope you can restore it from there.
I just bought the book: Sams Teach Yourself iPhone Application Development in 24 Hours.
In the book it uses xCode 3.2.4, so I went ahead and tried xCode 4.3 (the current version), but I didn't understand what to do...
I then found this page...
https://developer.apple.com/downloads/index.action
I downloaded the version of xCode used in the book (just so I could see the same thing the book shows).
But, I'm getting two errors each having something to do with the Interface Builder...
"This version of Interface Builder does not support documents of type "Interface Builder Cocoa Touch Document (XIB 3.x)" targeting "iPhone/iPod touch"."
And it comes up twice for two different documents in my xCode project.
How can i get it to work? In the book the code I put in works just fine.
Also my Mac Version is: 10.7.3
Do not waste time learning anything about Xcode 3.x. That would be like learning how to build catapults and siege engines in preparation for a career in the military.
Apple completely rewrote Xcode with version 4.0, and every single thing about the user interface is totally and completely different. If you invest time learning 3.x, you will be totally lost and confused when you move up to 4.x (version 4.3. was just released, and there is yet a new version on the horizon.)
I was totally lost and confused for about 2 weeks when I made the move from Xcode 3.x to 4.x, and I do this for a living and have been using Xcode for over 6 years now.
Unfortunately, the iOS development books are behind the curve when it comes to versions of Xcode.
Do yourself a favor and set the Xcode 3 book aside and find an Xcode 4 book (an ebook might be a better choice, since they can be updated.)
From what I just read, the xib files you have are not compatible with the newest version of Xcode.
You may learn loads by fixing this.
Don't delete the two files yet...
Will the xib documents still display in IB?
Try this:
Rename the two xib files to some other name.
*) With the old file open in IB, click View, Utilities, Show File Inspector.
Click File's Owner, Rename
1) In toolbar click File, New, File
2) Choose User Interface, Empty, Next, Next
3) Type the name of the corresponding .h file, be case sensitive. Click Create.
4) Click File's Owner
5) With the new file open in IB, click View, Utilities, Show Identity Inspector.
6) For the class name, Use the class name in which you are attempting to fix.
7) Drag a New View object to to the canvas, right click the new view, and set a Reference to the file owner's view variable by dragging to File Owner.
At this point, you could attempt to copy all the objects out of the old xib and paste to the new one. Make sure you check all referencing outlets and target action stuff.
8) Delete the old files in Xcode by right clicking and choose Delete, References Only.
Let me know if this works or not.
The Project Navigator has this nifty filter at the bottom (icon with a clock). When you click it, it only shows the files which have been edited recently.
Problem: There seems to be no way to reset this. My project has nearly 200 source files and I use a lot of them from day to day. So this list is getting bigger and bigger, and therefore less useful over time.
Often I am just done with something and then I'd just want to get rid of these files in the recents filter.
Is there a secret way to reset the filter? Xcode4 must store this information somewhere.
Navigate into the .xcproject or .xcworkspace package using the terminal or open package in Finder. Clear the contents of the <username>.xcuserdata folder.
I had this problem today, and apparently Apple fixed the bug. Just click on the clock icon again to toggle.
For me, restarting Xcode (I'm using 7.2) reduces the number of files shown when the "recent files" filter is on. But I don't know how the files that still remain are determined.
Guys, i wonder if any one can help - My project was fully working in both the simulator and on a device, however, i renamed the project in xcode 4 (double clicking at the root of the project navigation pane, it was happy to rename any references - but now when i launch the app it only opens to the main window (yes it has outlets, all have outlets etc etc),
no code in the app delegate stops at a break point (even in didFinishLaunchingWithOptions)
so unsure what i could have missed, i have looked at other answers and everyone writes and says "missing outlet" etc.
I have dragged some backed up version of the app delegate that used to work and no difference, what could i be missing.
I do have source control, however currently in the process of merging from VSS to GIT.
thanks
lee
Check your Info.plist for what it uses as it's Main Nib File. Perhaps something changed there? Also, within the nib file itself you might have problematic connections to classes that are still named with the old name.
Sometimes IB will hold onto old or bad references, and I cannot seem to remove or edit them.
EDIT I have made this a wiki question with the intention of gathering more data on the phenomenon. Answers involving situations where other coders have encountered this are welcome.
This happened to me again last night with a table controller. When I created a spike project to try and reproduce the error, the system worked the way I anticipated. Then back in the actual project the bad behavior continued, even if I remove the xib file and all controllers involved.
Creating a whole new project with none of the original (problematic) xib and nib files worked correctly.
This question is not about the specifics of this incident but about this type of incident in IB.
Does anyone know more about this type of bad IB behaviour, and possibly a more stylish way to to eliminate it than nuking the project?
Note, removing the offending IB files and recreating them in the same project has not solved this for me in the past, only whole new projects.
Answers regarding examples of when/how this glitch has been observed/created are welcome as well.
I fixed this type of caching problem by clicking File > Read Class Files ... and pointing IB to my class files. Bingo, it read them fine, and everything worked. :-)
The only real suggestion I have is to file a bug report at http://bugreporter.apple.com/ with a reproducible project as the attachment; in my experience Apple do look at these things. That said, you say that re-creating the XIB in the same project didn't fix the bug. What about replacing the other end of the link; i.e. re-create the header file and use that new header with the existing XIB? Perhaps that's sufficient to prod IB into updating its model.
I just had a project where this happened and I was banging my head trying to get it to update properly in IB 3.2 (732). I really did not want to redo the xib from scratch. I tried drag/drop of the *.h files, restarting, reloading everything and it didn't work. I also tried File->Read Class Files which didn't work. Strangely though, File->Reload All Class Files worked like a charm.
I find that File > Read Class Files fixes it for a single nib file, however the nib doesn't remain in Sync with any future changes and the fix doesn't apply to any other files in the project either.
Restarting and/or clean building didn't help either, but new projects are fine. This has been happening to me in Xcode/IB ver 3.2.2 - so far the only solution has been rebuilding the code in a new project.
Maybe not the answer you want, but here it is: Do not use IB! :-)
I had troubles using it too, even when reproducing exactly the steps as described in some Apple docs, trying multiple times from scratch. So after 3 days I just gave up and started doing everything programmatically, implementing my program in half a day. I have never looked back since. I only launch IB occasionally to look at sizes, so I can feed them into my code.
It will probably be less easy to update my GUI over time, but if your story is a real recurrent problem, I'm glad I parted ways with the beast!
When you say old or bad references, do you mean it is trying to link UI elements to outlets or actions in a class that no longer exist? If that is the case then go to the connections panel (cmd-5) and select the object in your nib file. It should show you all the connections. Any where the text is greyed out and have an exclamation mark should be deleted (hover over and click the x).
In IB, you are only connecting to a "promise" of what your class will be like when the app launches. IB normally only lets you connect stuff that can fulfil that promise, but if you change the header in Xcode there's nothing IB can do about it besides warn you.
Try making a clean build of the code and then see if the old references remain in the xib
You don't say if the problem has persisted across restarts, so I think it might be this issue: There is a rare bug in Xcode's build process where sometimes old versions of output files are stuck in the /tmp folder and won't get updated. IIRC, the easiest solution is to clean the target and reboot your computer.
Are you saving the header files? Interface Builder parses the content of your header files on disk, not the unsaved files in Xcode's editor. If you add an outlet to a header file, and switch back to IB without saving first, IB won't see the new outlet.
I had exactly the same problem with IB when I created a new project out of an old one.
I can synchronize IB with the new .h files but IB still gave the removed references (from the old project) when I right-clicked the object ( the class name "MainController" was the same from the old to the new ) even though those references did not exist in the updated code at all.
"You don't say if the problem has persisted across restarts, so I think it might be this issue: There is a rare bug in Xcode's build process where sometimes old versions of output files are stuck in the /tmp folder and won't get updated. IIRC, the easiest solution is to clean the target and reboot your computer." I tried to clean the target but it did not work.
However, once I deleted the MainManu.xib and created a new one (there would be a bit work to design the interface by hand), the old references were gone.
I experienced the same problem. It happens when I open a project made with old Xcode version. Interface Builder does not sync correctly with Xcode. Yes, I can manually update the IB cache with the 'File->Read Class Files...', but even with this method garbage remains. I mean old IBOutlet and IBAction still shows up.
Just had this type of incident and fixed it by using XCode's refactoring to rename classes to different names. Seemed to get stuff restarted.
Reading the problematic class file again has solved this problem for me.
QUICK EASY SOLUTION: - no computer restart, no new project required . . .
Unfortunately none of the suggestions in this post have fixed this issue for me (aside from restarting my computer and then starting a whole new xcode project)
MY SOLUTION...
Anyway, the only other quick fix (that works for me with Perfoce at least), is to back out (revert) my changes in my revision control system. We are using Perforce, and this seems to work just fine.
I didn't have to create a whole new xcode project, no restarting the computer, no restarting xcode even, no manual deleting of files or references, no re-references classes, no click and drag garbage to deal with, no manual settings changes, etc.
DOWNFALL...
If you are walking all around xcode and the IB for a while, and have made a lot of changes, and then all of a sudden the issue occurs... you will then of course lose everything in the files you revert... QQ
glhf
-eric
SIDE NOTE...
this is a pretty bad bug, and definitely consumes a lot of time, especially if its your first time coming across this issue (and I'm sure everyone here realizes, that time is essential to a developer). This is the first time I've ever been disappointed with apple/obj c/xcode (started 2 months ago), and i sense this won't be the last : /