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
Related
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 noticed that Xcode 7.3 always keep building, even in idle time. This loads CPU much, so sometimes it stops responding. Does anyone have an idea how to turn of this "feature"?
This may be related with mutli-target workspace, cause usually it builds different targets, not currently selected.
After some time struggling this, I finally solved this issue.
Xcode started idle build right after I open Interface Builder. Removing #IBDesignable across all project solved this, so I hope this issue can be solved in future Xcode updates to get using #IBDesignable again.
in XCode: Editor > Automatically Refresh Views
Unselect it and re-run project. Thats it!
Going along with #oleg-kohtenko's answer, closing all Interface Builder windows seems to fix the issue without the need to remove #IBDesignable.
And if you aren't really using IBDesignable, you can still use IBInspectable attributes without causing the building problem.
Just my two cents if designables agent gets hang on Xcode 9.
If you were visualizing the problematic storyboard as iPhone X, edit such storyboard file as source code (right click -> open as -> source code).
Near the top, you'll see a xml block stating
<device id=“retina5_9” ...>
<adaptation id="fullscreen"/>
</device>
Change the id to “retina5_5” (iPhone plus, just the option I used, I’m assuming others would work).
Save and open the file as interface builder and you should be fine.
Now take the time and file a bug report :D
Happy coding!
So this is just bizarre. If I create a custom Table View Controller as a subclass of UITableViewController, I can't reliably edit the .m file. When I click on it, I can see everything in the file, but I can't actually drop the cursor in to edit the code; it stays fixed in the top-left of the screen. Anything I type will appear, and any code already in .m that happens to be on that line will randomly appear. It's like a static image of the .m contents are on the screen, but the actual text is hidden.
Eventually the entire editor just goes blank. Everything else works fine. I wiped Xcode with app cleaner to pick up all the loose com files, restarted, re-installed Xcode from the dmg and re-created the project and still have the same problem (this is under Mavericks, by the way).
Granted, Xcode 5 doesn't seem to have this issue, but I'm quite new to programming and am following a course that's based on Xcode 4. And at this point the issue is just so stupidly weird that I want to figure out what's going wrong. Any insights?
I've given up. If for some strange reason someone happens on this question and has the same problem, it's not worth the energy; just head to Xcode 5 and live your life bizarre-error free (for now, heh).
I was having the same problem. I just cleaned the Build Folder and everything seems to be working perfectly now. You clean the build folder by selecting Product, hold Alt, and then "Clean Build Folder.
I too had this problem after upgrading to XCode 5, then downloading and installing XCode 4.5 (without removing Xcode 5). What I wound up doing was to create all my new UITableViewController files (File->New File->Objective C Class) as UIViewController files, then modifying the parent class to UITableViewController in the .h file.
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.
I am running a "old" Xcode 3 project in Xcode 4 and code sense is not working for my own classes. I have tried following:
Clean/rebuild
Remove Derived Data
Installing 4.3 documentation
Restart
Without any luck.
Sometimes the code sense works but mostly I just get "No Completions".
Try this:
Open Organizer then Project Tab.
Clear the "Derived Data". Xcode should re-index your project then and code sense should work. At least worked for me.
I know this is late, but for reference: http://sealedabstract.com/code/when-xcode-4s-code-completion-autocomplete-breaks/
Close the project, leaving XCode still running.
Open XCode’s Organizer window, go to the Projects Tab, select the correct project, and hit the Delete button next to “Derived Data”.
Quit XCode.
Navigate to your project’s .xcodeproject file in Finder. Right-click, choose “Show Package Contents.”
Leave the project.pbxproj file, but delete the project.xcworkspace file, any .pbxuser files, and the entire userdata folder.
Open the project in XCode. You will see XCode riding high on the CPU usage for around 10-60 seconds, depending on the size of your project. The activity window will say “Indexing”
When your CPU spike returns to earth, code completion will be working again.
There's a lot of deleting going on there so please be careful, but this definitely worked for me.
I've been doing this, and it's worked multiple times for me (after trying all of the above previously).
Edit: Now I just hit space, backspace (the mac version) and rebuild... works nice. Then, remember to scroll (sometimes the colors don't show up until you scroll somewhere)
Find your prefix file: "ProjectName_prefix.pch".
Comment out some line. (basically change it)
Build your project, doesn't matter if it fails or not.
Uncomment it.
Build again.
I'm betting only step 2 (modify the prefix) is what does it, but these essentially get you back to running. Suddenly everything magically recolors itself and completes functions.
Good luck if that doesn't fix it, perhaps try doing this to your dependency pch files (three20 or FB api's)
Clearing the "Derived Data" only works temporarily for me. I have to do it and then restart Xcode like 3-4 times each day to get code sense working again.
I found out the real cause is in the Target's Build Settings. I moved everything from Header Search Paths to User Header Search Paths and it is fixed. In my case, the framework I'm working with is RestKit.
BTW, I came up with this because I was adding another project (QuickDialog) into my project and I was curious that it is using User Header Search Paths, but not Header Search Paths. Here is the difference between them.
You can able to fix that issue by change build settings like this, PreCompile Prefix Headers :NO
FYI, if one file doesn't have code sense but the rest of your project does, check that its added to a target. Once I did that I got code sense back in that file.
It's been ages but the answer is just to move the code into a new folder and the code sense should be working now.
This happened when I added a new Objective-C Class and the code sense doesn't work only on the newly added .m and .h files (on XCode 4 latest update during this post).
Close all xcode windows
Delete all your projects from xcode>window>organizer and restart your project. It will now sense and index your project properly.
I wrote about it in detail here.
Basically my fix was that with localization. I upgraded from xcode 3.2.5 to xcode 4 and then screwed around with built in interface builder and turned on localization for a XIB file accidently which placed my source files in en.lproj directory. After moving them back to Classes folder it worked perfectly.
Again, for the sake of helping others with this issue which, in my case, happened upon upgrading to Xcode 4.3.
Of course I tried the solutions offered in this post, and none of them worked. But the suggestion to move the location of the project in Finder brought back some Code Sense, but the suggestions didn't make any sense.
I ended up deleting my project and re-cloned it from the git repository.That brougt back Code Sense for me...
I open a second project in the background whenever my Xcode's code sensing stops working (it usually works the first time i open the project but after a while code sense no longer works). So what i do is to open a second project in Xcode. Xcode will start indexing the second project and magically the code sense for my main project is back.
Running Xcode 4.3.1 on Lion
Hope this helps someone.
From this comment here I was able to debug the problem on my end, it seemed to be a bad -w flag that the clang preprocessor wasn't recognizing properly. Basically, running
defaults write com.apple.dt.Xcode IDEIndexingClangInvocationLogLevel 3
in Terminal increases the verbosity of the indexer, and should help you track down issues. Open Console.app and look for messages from Xcode, the search string IDEIndexingClangInvocation helped me find them.
For me it happened simply because the file had no target membership. If the first few answers did not work for you, go to your .m file (presumably it's this file that you're having trouble with), open the Utilities view (Edit -> Utilities -> Show File Inspector) and under "Target Membership" check the target to which you want this file to belong.