Xcode 4 shows no files after loading project - xcode

I've loaded a project in Xcode 4 after not looking at it for a while. Xcode shows its progress bar and indicates in text that the project is loading, and it appears to finish, but then there are no files shown in the hierarchy or flat views. There is nothing showing in any view (except for one breakpoint in the breakpoints view).
Any ideas? Xcode gives me zero indication that anything is wrong, it shows me nothing.

I just had the same issue. After a few hours scratching my head and trying all kind of things, I finally found a fix: remove the whole package 'project.xcworkspace' inside the XXXXX.xcodeproj package.
More specifically, when you find the 'XXXXX.xcodeproj' file, right-click it, and select 'Show Package Contents'. This will get you inside the package where you will find the 'package.xcworkspace' file. It is best to do this while the Xcode project is closed.
Maybe that will work for you or for others with the same issue in the future...

Some of the project views have the "Recently Changed" filter icon. For me the problem was: i had that enabled in the Project Navigator, so it was only showing the files i recently changed. It looks like this.
I'm using Xcode 6.1 though.

I had a similar issue. After archiving a project the files would disappear from the project navigator.
It turned out that somehow XCode had added the word "main" to the searchbar below the project navigator so that almost all files where invisible. Quite frustrating.
It might be the same case for you..

For those who make it here, I was opening a older version of a similar iOS project after upgrading to the latest XCode (6.2), and was seeing the symptoms labeled in this question (missing files, folders etc.)
My solution: at the bottom left of the screen, unselecting 'Show only files with source-control status" which happened to be set on (it's blue when on). The icon looks like a 4-pt star inside a square.

remove the whole package 'project.xcworkspace' inside the XXXXX.xcodeproj package. may cause to any other error so please ignore and trying finally
You can quit xcode and reload again your project it help you

This happened to me when I tried to do an alt-tab, on a VM running in TeamViewer in Windows - Click the search bar below, enter delete multiple times and the invisible search term cleared up

I had the same issue. Besides the answers above, it could also be that you have already accidentally opened the project in another Xcode window... Close that and reopen everything and it should work.

Related

XCode Navigator cannot reaarange files

Got an irritating issue with xcode 5.1
I have lost the ability to rearrange files and groups within the xcode project. If I try to move anything I get no visual feedback and file returns to original position when dropped.
It works ok on other projects but I have done something to this particular project, and cannot seem to undo the problem...closed re-opened project/xcode etc.
Any ideas?
Thanks
As soon as I asked the question, I found the answer myself (after getting frustrated for hours).
The problem is I had the letter 'e' in the file filter box at the bottom of the navigator. So, obviously, I am prevented from rearranging!
....for info purposes!

XCode 4 osx 10.9 - folding methods crashes

After updating to osx 10.9, in any of my projects doing the following crashes Xcode 4.6.3:
fold a method, if statement, for loop, etc
click on a different file
click back on the file with the folded code
When clicking back on the file I notice that all the line numbers are gone but the one at the very top (which is usually some random number and it sort of flashes a bit). Less than 5 seconds after clicking on this file XCode crashes.
This is repeatable. When I reopen Xcode and open the project, the problem persists. Now I am unable to access that file. I've tried closing Xcode and releasing the memory in RAM. I've tried removing the reference in the project and adding it back. Yes the problem persists.
This is massively frustrating and has completely derailed my development. Has anyone else had this issue? Anyone know how to solve it?
Here's the crash report if it's helpful.
-GW
Ok I figured it out, but am still curious as to why this is happening and how I can still fold my code without this problem.
click on the problem file.
click anywhere where the code should be (sometimes all the code appears to be gone)
goto Editor > Code Folding > Unfold All
That cleared it up.
It happened to me too. I fully share frustration and reasons why not going to rev 5.
Here's my solution :
exit xcode
go to your myProject.xcodeproj file
look inside the package for myProject.xcworkspace file (right click / Show Content)
back up myProject.xcworkspace outside your xcode hierarchy
delete myProject.xcworkspace file
restart xcode (a clean myProject.xcworkspace will be created).
NOTE: Works for me, but I'm not using workspaces. I have not tried, but I suppose that if you want to preserve your workspace settings you'd have to selectively delete the UserInterfaceState.xcuserstate files further down in the package hierarchy?
I had to delete UserInterfaceState.xcuserstate file to solve these reoccurring code/comments folding crashes in Xcode 4.6.3 running on OSX 10.9.
This file can be found at projName.xcodeproj(Show Package Contents)->project.xcworkspace(Show Package Contents)->xcuserdata->username.xcuserdatad->UserInterfaceState.xcuserstate
Note that you will loose all the saved user state info of your project, which means all your open tabs will disappear, folded code will be unfolded etc. And the crashes may start reoccuring if you fold any code or comment again.

Storyboard Internal Inconsistencies

I have a similar situation explain on this thread (XCode 5 Storyboard Internal Inconsistencies), but I installed the final version of the Xcode and never installed any beta version. Additionally, I can't add comments in previous thread cause I don't have enough points. So i need to ask my specific case.
In XCode 5, I have a problem with all of my projects "The document 'main.storyboard' has X internal inconsistencies that were found and repaired. Please save this document to fix the inconsistencies."
If you choose to list the inconsistencies, you see that it's saying that some Images in my resources section, that uses this image, and is duplicating in the Storyboard. I try to save the document, but it does nothing, and when I relaunch the project, I get the same error.
I try all this things with NO SUCCESS:
I delete all duplicates in storyboardFile file.
Drop the image file from my project and add again.
Reconnect UIButtons with the problem image.
Change the image name file.
In my research, also I create a new project in XCode 5, add a same image in two objects inside Storyboard and got the same message.
Anyone have the similar problem?, and more important, anyone have a solution?
I have XCode 5 and OSX 10.8.5.
**** UPDATE *****
I found a workaround. The error is generated when one image inside the storyboard is used several times, if you delete the reference of the image and assign the image to the object by code, the error disappears, but I don't like it. I'll research a little more, but apparently is a bug from Xcode (I hope not).
This problem occurred for me Xcode 10.1 but was resolved. The error message provided a "Show Details" button.
Clicking on Show Details showed my problem, a duplicate.
Right-clicked on the identified storyboard (Main.storyboard) to open as source code.
Searched for the duplicate declarations and removed one of the duplicates.
The error message no longer occurs including when the storyboard is reopened.
An easy way to fix this problem is to open up the Storyboard in TextEdit, then go down to the resources section at the end and delete any duplicate entries for images you see. They're sorted alphabetically, so it's fairly simple to do.
Saved the file, loaded up XCode and no more error messages.
I upgraded to Xcode 5 last night and am experiencing multiple issues, including the one you described above. I also seem to have found a workaround, albeit different from the one you found.
To get rid of it I saved the project, closed it, opened a different project and ran it in the simulator, quit Xcode then reloaded the original project.
Error message no longer appeared.
I have no idea why but this seems to have solved it for me.
Now to tackle the other niggles......... :-/
Same error today after upgrading to Xcode 5: internal inconsistencies relating to images that are used more than once in storyboard, but I found a solution that worked for me here: https://devforums.apple.com/message/883402#883402.
I created a new Asset Catalog (New file / choose "Resource" / Asset Catalog).
Once created, I selected the option 'Import from project' and imported all my images. Seems to have done the trick.
After installing Mavericks and Xcode 5.0.1 the problem was fixed.
Try to find under inferredMetricsTieBreakers section at the end of the storyboard unused segue references in the whole document as in the photo

Xcode 4.6.2 error: "cannot run on the selected destination"

I've been having this problem for a couple weeks now. All of a sudden this happened to my project and I havent been able to fix it. Its a basic tab-bar app and i've barely even started heavy coding on it. Running xcode 4.6.2 (tried on 4.6 and 4.6.1 also).
The actual error says:
"Cannot run on the selected destination
The selected destination does not support the architecture for which the selected software is built. Switch to a destination that supports that architecture in order to run the selected software."
Thanks in advance.
Well here's my new fix: I had (for some reason) changed the highlighted line below:
I had changed the ${EXECUTABLE_NAME} to something else. Changing it back did not fix the issue immediately: I had to first click the + to add a new row then delete the new row.
My app runs fine now
OLD FIX:
OK, so yes, it's true, there are other questions like this one. They helped me figure out a different (and stranger) solution.
I right-clicked on my .xcodeproj file and chose "Show Package Contents"
I then opened "project.pbxproj"
I copied all the text from it to another file, deleted all the text from it and saved
This "crashed" my XCode Project that I had accidentally left open in XCode.
I closed my project, then pasted the original contents of "project.pbxproj" back into "project.pbxproj"
I saved "project.pbxproj" and closed it
After opening my XCode Project again, I was able to run it on my device!
To me, it doesn't make sense why this worked because I didn't modify an files... But it did, so hurrah!
PS
Back up your project beforehand, just in case.
EDIT: Well mine has stopped working again and I can't use the above method to fix it...

Xcode 4 code sense is not working

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.

Resources