I was creating a new View-based Application in XCode, adding some outlet and actions, using the IBAction and IBOutlet tags, into the automatically created controller view header file. I then double clicked the 'project_name_ViewController.xib' to launch the interface builder.
However the outlets and actions did not appear in interface builder. The only way I could get them to appear was the close the xib file and reopen it through file -> open command in Interface Builder it's self.
I recently upgraded to Snow Leopard, before that I never had this problem.
Has anyone else come across this?
Xcode is full of strange bugs. I always follow my 15 step arcane black magic ritual before I make an ad-hoc or release build. Any time something like your problem happens, I put it down to the flying monkeys twisting bolts somewhere in Xcode and restart the program (sometimes the computer). That generally fixes it.
Of course with outlets and actions, it's easy to forget to save the source header before you swap over. Make sure to save and build. Errors in the source can stop them from showing up in IB too.
Related
I am writing a macOS app in Swift4. I'm targeting macOS 10.9, so I'm using xibs instead of storyboards.
When I try to run and open the nib via showing the window, it logs an error:
-[NSIBObjectData initWithCoder:]: corrupt and unarchivable nib file
-[MyWindowController loadWindow]: failed to load window nib file '/Users/toadzky/Library/Developer/Xcode/DerivedData/MyProject-cdudiyhqvfaauudsignqhtkqlfeu/Build/Products/Debug/My App.app/Contents/Resources/MyWindow.nib'.
The file is a xib, so i'm not sure if it's just an outdated error message. I'm subclassing NSWindowController and using the init(windowNibName:) constructor for my window controller.
I've tried restarting Xcode, cleaning and rebuilding the project, modifying the xib so xcode will rewrite it, etc. I haven't re-created it from scratch because it's a fairly complex view, and it's time consuming to redo so I'm hoping there's an alternative solution.
Update
I rebuilt the entire XIB from scratch, no copy-paste since I couldn't be sure what was wrong. Everything worked fine until I added some custom formatters using interface builder. Then it broke in the same way. I took them off and it worked again.
Two hours later, I added the custom formatters back and it works fine.
I'm leaving the question open in the hopes that someone will be able to provide some troubleshooting advice for when Xcode decides to arbitrarily not work for a while.
Make sure that in your init method you are initializing the super class and returning self.
While developing a navigation based application from scratch, I added some new uisubview Controller files to my project by the name myview.m, myview.h and myview.xib. After saving it, when i switched to interface builder to carry out linking task but the xib file was not shown by the interface bulider.
I restarted both the applications to fix it, but it didn't work. Please suggest me how to resolve the issue because i can't proceed further.
MAC OSX: 10.6
XCode: 3.2.6
One of the similar issues I faced earlier was that the methods added to .h files were not visible in interface builder, which I resolved by making the interface builder reading the .h file externally from file menu.
but I was unable to resolve the issue with the xib file. Please suggest me some solution.
Its ok if it is not shown by default. Simply mention the name over there. It works.
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.
I've made an iPad app. Now, I'm changing some UI elements in the NIB. When I run the app in the simulator none of my changes appear.
I've tried touching the project before building. Nothing is working.
Can anyone shed some insight?
It seems you are not loading the correct NIB file, or more probably you have for gotten to make the right connections in you NIB file with the owner file.
If none of these are the case we are going to need some code that shows where you load you nib and/or a NIB we can inspect ourselves. :)
Try this:
Clean the target (⇧⌘K)
Delete the app from the Simulator
Build & Run as normal.
Make sure you save the changes in Interface Builder. I've found that on occasion I've forgot to save changes there, with predictable results.
In the Simulator menu, select "Reset Content and Settings…" which wipes out anything that was there previously. Xcode saves time by not installing anything it thinks is already there. This usually works fine, but occasionally can lead to out-of-date resources not being updated.
When I double click the XIB file in Xcode, Interface Builder typically launches a few different windows, one of which is the View window. For some reason, however, the View window isn't opening for one of my XIB files. If I open any of the other XIB files, however, the View window does open.
I'm not sure if there's a way to manually launch the View window (I looked through all of the menu items and couldn't find a way) or if I broke something in my XIB.
Update: I created a connection from the app delegate to a navigation controller, which seemed to break something. When I cleared that connection, the View window came back.
Are you referring to the window which allows you to view the objects in your XIB, or are you referring to the window which represents your XIB's primary view or window?
If you're referring to the main window which allows you to view the objects in your XIB, it sounds like you're most likely corrupted. I say this because that window represents the XIB file in whole, and if it isn't open, the file's probably not open. (Pro tip: Check the Window menu and see if the file name is listed in the file list. If it's not, it's not open. If it is, it is open and perhaps off-screen -- this has happened to me in the past when I've switched from a multi-monitor setup to just the laptop screen.)
If you're referring to a View or Window inside the XIB, double-click its icon from the XIB's main window.
I double clicked it and nothing happened. It just selected the window, wherever it may be and that's it. I tried Window -> Bring all to front and nothing.
Finally, I managed to recreate the problem. Usually I keep Xcode on my main screen and IB on my other monitor. If I close IB with my UIView there, disconnect the external monitor then start IB again, the said view disappears. Maybe it just slipped somebody's mind until now. I tried enabling expose, but it wasn't on that screen either. I couldn't bring the view back until I connected the external monitor again.
Hope that helps!
I had the exact same problem with opening a .xib file in Xcode and not being able to find the View window (that shows the application UI). Here was how I fixed the problem in my situation ... Open the .xib file, select the View object, go to the Tools menu and select Reveal in Workspace .. for me, this opened up the View window. Good Luck!
UPDATE - Or you can just double click the View object instead of going to the Tools menu - I think the first response suggested doing this, though that wasn't clear to me until after I posted this response.
I had the same problem. I fiddled with Deployment Target (changed from iPhone 4 to iPhone 3.2) and Development Target (changed from Interface Builder 3.2 to Interface Builder 3.0) for the xib file. It works wel now.
I solved this problem by playing around with my display settings. I had my iPad connected to my MacBook using Air Display. Disconnecting the iPad with Interface Builder windows left on it seems to leave those windows in "la-la land." Even re-connecting the device didn't seem to work. I had to open the Display preferences, choose "Detect Displays" and then choose "Mirror Displays". After that I de-selected "Mirror Displays" and closed out Interface Builder. Opening Interface Builder again brought the window back, but it was on my external display.
I think this is a bug in the sense that Apple should figure out a way to put all the windows back on the main screen once you detach the external one.