I have a storyboard which contains views which simply refuse to change. If I make changes to the controls they're not reflected in either the simulator or a phone. I don't have a 'Derived Data' folder under /Library/Developer so I can't delete it. I have, however done a clean, with no effect. There must be another cache somewhere it's using.
After a fair amount of scouring, I eventually cleared the cache by emptying /Users/Library/My user/Developer/Derived data, then doing a clean, then restarting Xcode.
Related
I have a strange app behavior: The App updates the GUI changes only after returning from the background to foreground. When launching, some GUI elements are also missing and appearing not until returning from background state. Any touch on buttons fires not until going to background and reentering foreground.
The problem is with iPhone, iPad and both simulators and with Xcode 5.2.1 up to 5.3. It appeared after deleting the app from the devices and resetting the simulator. Beforehand there was never a problem like this with this app.
When you can't fix it, restore it: With version control i reverted the AppName.xcodeproj directory (Finder shows it like a file) and it fixed the problem.
Then Xcode offered me to "upgrade to latest recommended settings and perform project clean up" which "removes unnecessary build files". I did that and also chose the "create snapshot option". After that i had the same problem again.
The i reverted to that snapshot before the project settings update and it worked again.
Key take-away: "upgrading project to latest recommended settings" can have nasty side effects. Snapshots and version control are great stuff.
Further investigation showed that in Settings.bundle one missing Root.plist file was reason enough to kill my GUI. I had there Root~ipad.plist and Root–iphone.plist and thought the Root.plist is no longer needed. Looks like you need all three if you want separate plists for iPhone and iPad.
I click on the XIB via the project navigator. It opens up and immediately changes the icon to gray showing I have unsaved changes. If I save changes, click on a different file and click back to re-open it, more changes. Always modifies on open.
It happens with one XIB file in this project and a couple in another project. I'd love to know why it's happening and what I can do to fix it now and prevent it in the future.
Note: using Xcode 3.2 Build 4C199 with Snow Leopard
Edit: I've added a couple sections which got removed from the XML on one of these open/modifications
<key>outlets</key>
<dict>
<key>addEventTabBarController</key>
<string>UITabBarController</string>
<key>window</key>
<string>UIWindow</string>
</dict>
<key>superclass</key>
<string>NSObject</string>
and
<key>outlets</key>
<dict>
<key>courseTableCell</key>
<string>UITableViewCell</string>
</dict>
<key>superclass</key>
<string>UITableViewController</string>
I wound up submitting this issue to Apple. Their response was unenlightening, and talking about possible optimizations, updating meta data for new version of Xcode and the like.
I tracked 100 versions from clicking off and on the file. As Apple said, it was "optimizing" every time, but each time it simply moved some XML tags around. Never happy with it's own optimizations it moved them around the next time they were opened. I'd consider it a bug with Xcode, annoying, but mostly harmless.
This only happened with old XIBs and either moving the contents into a new XIB file or (what really happened) Storyboards got rid of the issue.
I did not want to use storyboards as suggested in one of the other answers.
Here is an alternative simple/quick fix.
Go to the Interface Builder Document Properties on the inspector when selecting the xib view file.
Then you need to
change "Deployment" to something different from Project SDK, in my case I set it to the latest iOS version (iOS 6 currently).
change the development to something different from "Previous version", in my case I set it to the latest Xcode version 4.5
I run Xcode 4.5.2 on Lion.
Hope this helps.
basic Idea...
XCode stores lots of version numbers of all different sorts of things. If you look at the XML representation of the XIB, you should find that the vast majority of these little changes are in these version numbers.
How it happens...
Whenever you do an update of Xcode, many different things within Xcode (and often inside the SDK) get updated. If you make a change to a XIB file, those version changes get stood in the XIB. So, if you happen to open a XIB file, the version changes get put into that file. As soon as you build or run the app, those changed get saved to the file.
But I haven't update Xcode in a while!
Well, whenever you did your last update, the XIB files will be updated with the new version numbers as you open them, one-by-one over time.
Edit XCode 4 is better now, (maybe), if you're tempted to vote this down then ask yourself, "Have I migrated from XCode 3 to XCode 4 using Versioning?" If no, then you have no idea what you're doing, and please don't vote on this. If you have, you know how bad you suffered, but yes this question is otherwise dead. If you do find yourself opening a legacy project, just recreate it and copy the files.
I don't know the exact answer, but I do know these things will help you find it:
XCode 4 is notorious for screwing things up.
If you put your directory into a Versioning system, (Git), then grab GitBox and save your project to give it a state and create a git repo out of it. The git repo will save the state. Gitbox will visually show you the changes.
After opening it, you'll be able to right-click on that file in GitBox and hit "see difference" or "view changes" or whatnot.
You will be auto-scrolled to the lines. If you can relate the XML to the Xib, you can figure out what changes.
I went from Lion to Snow Leopard, so I don't deal with this anymore.
For a reason unknown to me, the Release version of my application has started loading cached static files.
If i build in debug mode all is well and it loads the correct most recent files, this occurs on the device and inside the simulator.
Try going in the menu to XCode -> Empty Caches
Clean all. I don't remember how to get to it in the menus, but I do it often enough I have the keyboard shortcut ingrained. With no debugger running (hit "stop" if you have to), do Cmd-Shift-K. You'll get a confirm dialog asking for the depth of "clean" to do, and take it up on a full cleaning.
That'll delete all cached objects and the next "build and run" will build all targets from scratch, including updated images and nibs that it hasn't been getting fresh.
I fixed the issue by deleting the resources in xcode and also moving the files to trash, then adding them back into the project. Would be nice to find a way to stop this from happening in the future though.
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.
Everytime I do "Build & Go" the app to my device, It installs the app with a white icon, shows a black screen and "Failed to load NSMainNibFile MainWindow" in the debugger.
However after cleaning, and then recompiling it works fine. Is this normal? How do I go about this?
It is not normal.
For some reason your main nib file where your app icon and MainWindow nib are located is either not being created or is corrupted. Presumably this happens during a subsequent build after at least one successful build has been performed following a clean all.
Troubleshooting suggestions:
You should post the exact sequence of builds that triggers the problem. Preferably in a list format so its easy to read.
Check for any unusual resources like images, sounds etc that you may have added. Perhaps something in an usual format is trigging the problem.
Check your target before each compile to confirm that that the MainWindow nib shows up in the resources phase.
Copy your source files and resources to a new project. Sometimes projects get corrupted and when they do, they cannot be repaired.
Check for any resource file names that have unusual characters in them. IIRC, file names with multiple dots can cause problems e.g. my.file.name.jpg.