XCode Project Navigator Bug - xcode

Recently, while developing an app for iOS, XCode has begun to exhibit buggy behavior that hasn't gone away even after reinstalling my entire Mac (which leads me to believe that something in the project settings may be causing this). In the left panel, switching to a pane other than the Project Navigator then switching back to it causes Project Navigator to expand ALL of the folders in my project. In addition, if I attempt to make a new group by right clicking and selecting New Group, a new folder shows up momentarily, then disappears again. The .pbxproj file is modified as well, but the new folder doesn't show up even if I restart XCode. Has anyone been able to fix this before? I wasn't able to find any posts anywhere relevant to this (it's kind of a hard problem to Google...). Thanks!

Update: I tested the bug by creating another app; the new app didn't have these issues, so I concluded that the project I made must have been corrupted somehow. I deleted and re-cloned the project from GitHub, which fixed the problem. Something went wrong with Xcode's settings for my project; I'm curious as to what the problem was, so if anyone has had experience please let me know!

Related

Xcode 8.2.1 becomes unresponsive when i click on main.Storyboard

First, there's one old question with the same issue, but since the answers don't work for me, i'm posting this one:
I had problems to open an old project at all. So i deleted xcuserdata and the derived data, from the options tab, too. This one worked fine and i was able to open the project, but now when i click on the storyboard Xcode "hangs" and i have to force it to quit.
This happens only if i click on main.Storyboard, every other file in the project works fine when i click on it.
The last thing i tried was to run the project and in the last 5 minutes, it says Compiling 2 of 2 Storyboard files and that's all; no other result at the moment.
edit: cleaning the project doesn't work too.
edit2: It seems the problem is with my Xcode, not the project. I created a new project and Xcode freeze when i try to open the storyboard. Same with some other old projects.
Next step: reinstalling the Xcode.
Ok, like i comment previously, i tried a lot of things before consider to reinstall Xcode, but the most important were to run the project in other Mac and when i saw that there was no problem to show the storyboard i concluded that the issue were in Xcode.
I reinstalled it and it works fine.
Before everyone does that it's probably a good idea to see if your project run on other mac.
You can also delete xcuserdata, the derived data and the Xcode saved state.
Among the other things i tried:
I restored the version of main.storyboard i have on time machine, just before the crash. Didn't worked, but worth to try.
I also considered to replace the file with the same but from some old version. But the problem was, that i've made too many changes on the actual storyboard, so i needed to find a way to restore it.

XCode 4.5.2: Cannot run on the selected destination - Facebook SDK

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.
I am using the Facebook-iOS-SDK from GitHub: https://github.com/facebook/facebook-ios-sdk
tested latest commit (2a030e795aed343e7614e149a5ebdfa78b223a72) and sdk-version-3.0.8 tag, both having the same problem. Tested the Hackbook, Scrumptious, FriendPickerSample on both iDevices and iSimulator.
It was working before (on older version of XCode), so it could be the xcode upgrade, but my other projects work fine. I've tried multiple solutions on this site which works for others but not on mine, does anyone encounter this before with Facebook-SDK specifically? Thanks in advance!
EDIT: I have found the issue, if you install the FacebookSDK and you add the resources folder to get the facebook image buttons there is a Info.plist file. XCodes goes weird with this info.plist file. I have deleted it, made a clean and now it works perfect :)
OLD:
The same behavior here. On another projects it runs perfectly but in this one I have always the same problem. After some XCode restarts sometimes it runs ok, sometimes I "click" on run and then nothings happens, sometimes it runs...
The best option is to move the project to other path. Adding and removing the libsql3.0 from lib dependencies sometimes works too.
Sadly, it seems like this is a bug on XCode, it will build and run fine for once every couple of restarts and with the entire project directory moved to other path. This is very sad because apple always make good products for consumer but all their developer software are crappy compared to big M's
I ran into this problem. It seemed to start right after XCode hung and I had to force quit. This was a day before the 4.6 update. I hoped that that update might fix the problem. And I did get one successful build before I started getting that message (actually in 4.6 there are two different but similar messages that seem to alternate.
I solve the problem by letting XCode update the project settings. I first noticed this possibility when I made a duplicate copy of my project and open that, but it is clear that this option is also available in the original. Here is what I did
In the Issues Navigator just under my project "MyProject project" I had a message MyProject.xcode
Validate Project Settings
Update to recommended settings.
I click on that and I was presented with a dialog box with 4 checkboxes some explanatory text and the option to perform changes. I just let Xcode make those changes and everything has been fine since.
Remove info.plist from Facebook Resources folder. Changed the location of XCode project and Reset the iPhone simulator...now it is working :) Buggy XCode !!

Xcode 4 shows no files after loading project

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.

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.

Xcode 4.0.1 "Don't have permission to view" Old project file - Help!

I recently upgraded to Xcode 4.0.1 from the last version of Xcode 3x (not sure which). Install went fine and I can open and view all my old .xcodeproj files without problems. All except one!
The error I get inside Xcode is
"The file "GCSCalculator.xcodeproj" couldn't be opened because you don't have permission to view it. To view or change permissions, select the item in the Finder and choose File > Get info."
Obviously I've checked that and the permissions are exactly the same for all files as the ones in the projects that do open in Xcode. I changed permissions for everyone to ReadWrite just in case, to no avail. I feel I've tried everything obvious and can't seem to find anybody else with the same problem.
Anyone got any ideas about a fix or workaround? Typically it was one of the only projects that was actually completed so its very frustrating!
Thanks.
I ran into the same problem and found that clicking on the project in xcode and then switching the view to standard editor view will let you change all of the project settings. After editing the summary, info, and build settings areas it started working
Click to project-> Build Settings -> Compiler for C/C++/Objective-C -> Default Compiler. Hope it useful :D

Resources