XCode 4.2 - dropdown doesn't change after project rename - drop-down-menu

This question was marked as duplicate, and after the asker succeeded in renaming the project he got the same bug as me, and edited the question:
How to rename xcode project file
So if you look at the picture you see the device drop-down showing the wrong name. It's still showing the old project name, instead of the renamed one. I have the same issue.
I've searched in the target/project settings - there's no setting containing the old name.
I've done a clean build.
Tried to look for a .build folder to delete, but it's been moved to somewhere else.
Either way, I've run out of things to try, so if you've had this and solved it, just point me in the right direction. Thanks!

Well, duh. It was schemes. It used the old project's scheme for some reason. Product > New Scheme, click OK, make sure it's the selected one in Product > Edit Scheme.

Related

Cannot add localization in Xcode - Spritebuilder project

I have finished my first game project with Spritebuilder and its time for localisation. But, when I try to add a new localisation, even though I follow all the correct steps, no language is added in Xcode and no localised project folder are created after I click finish (see attached photo).
Hint: If I try to add the language again the list with the resource files is empty...
Any ideas?
Faced similar issue with SpriteBuilder, if you prefer Xcode's string format. Try this answer to restore this capability
I deleted the Localizations in Xcode, then I cannot add any Localizations back

Xcode duplicates my repository and renames its location to lowercase

I have a Git repository where my project is linked to. It is located somewhere like /Users/a/Documents/Xcode Projects/MyProject. I use Xcode's UI to commit changes and it worked perfectly for a couple of times. But now, out of a sudden, I get this error when trying to commit new changes:
The working copy myproject could not be reached.
Please verify that the working copy is reachable and try again.
As you can see, the message shows my project's name in lowercase and when I check the Repositories in XCode (File - Source Control - Repositories...). I see there are two, apparently identical, repositories (they both link to the same Origin), but one with the name all in lowercase.
The correct one location is /Users/a/Documents/Xcode Projects/MyProject as I told you. But the duplicated one is supposed to be located in /Users/a/Documents/xcode projects/myproject which, of course, does not exist.
Does anybody know why is this happening? Can anybody help me to delete this duplicated repository and make my project link the correct one? So I can keep using the XCode's UI to commit changes in my code.
I found that Xcode 4.2 can behave in two different ways depending on what exactly you select in the File->Open dialog, when opening the project from within Xcode:
The .xcodeproj file
The project folder (containing the .xcodeproj file)
Selecting 1 or 2 and pressing enter wil give me two different repositories with different paths in Xcode's Repositories, so sometimes it helps to close the project, delete both repositories and then open the project in "the right way", say 1 or 2.
I had the same problem. You probably clicked the recent opened project offered at the beginning of Xcode screen. I chose to open the project/workspace from manual selection in the file system and it solved this duplicated working copy issue. Hope it could be a help.

What Does Question Mark Mean in Xcode Project Navigator?

In the project navigator in Xcode, I am not sure what the ? is trying to tell me next to the file name.
I am sure it is not a coincidence that this is the same file that I dragged from my root directory for the project to the Classes folder (because the .mm file was there and I wanted them to be together). The project still compiles just fine, however my code sense broke recently and I am wondering whether this may be part of the issue.
Thanks!
It's the file untracked by source control.
Those characters refer to the source control.
? - Unversioned
M - Modified
A - Added
A+ - Moved/Renamed (R as of Xcode 13)
U - Newer version of a file on source control
More reference here
You can add to source control by selecting the untracked files
Following steps resolved issue for me:
Select all your files with "?"
Right click and select Source Control
Select Add Selected Files
Select Commit Selected Files...
On the popup dialog just drop some comment (no matter what=)
Screen
Those are uncommitted files if your using GIT, you need to right click Source Control>Commit Selected File manually. It should take away the "?" on the new version of Xcode 6.3.2 as of today
Along with all other answers. This shouldn't happen by default UNLESS you have changed the settings in Xcode.
From Xcode Preferences >> Source Control >> make sure 'Add and remove files automatically' is selected
I suddenly get one my file Unversioned (with ? mark), but it was old file.
It was .m file. Before problem occurred, I created copy of it, for making new similar class. I renamed a class and add new file to XCode.
Problem (with old file become Unversioned) was in not renamed comment string at beginning:
//
// MyFirstClass.m
When I renamed it, problem with Unversioned file was resolved.
//
// MySecondClass.m
Hope it'll helpful somebody.
P.S. Additionally maybe needed to remove and copy back this files.
Stage the Unstaged file, if its a working copy and the ? will change to A

Xcode 4.2 Product -> Run Greyed Out

My "Run" button under "Product" is greyed out and after trying a few things from various forums, can't figure out what's gone wrong.
I've tried removing the project.xcworkspace and xcuserdata files and letting xcode generate new ones, but no...
My co-worker uses AppCode from IntelliJ and when he pulls the code, it runs just fine. But if he opens the same files in his Xcode, his "Run" is also greyed out.
"Edit" your current "Scheme":
Make sure you have "Run" checked for that build target:
The scheme need to be fixed (I don't know why xcode changed it)
Here are the required steps:
, ,
Make sure you have the correct target selected.
(Upper-left in Xcode window, near the triangular Run button.)
My co-worker who uses AppCode had edited the configuration file, moved some frameworks around, etc... We noticed that there was a difference between XCode and AppCode in using relative vs. absolute paths in the project.pbxproj file.
Ultimately I just reverted the code to before his changes, so at this stage, I'm not entirely sure which difference in the config file actually caused Xcode to not be able to Run the project.
**EDIT
From the .git logs, it looks like AppCode was adding relative directories with 7 sets of "/../" and before there were only ever instances of 5 "/../" to get back to the root directory.
Rather frustrating that Xcode had no way of dealing with this from inside the IDE.

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