Xcode 4 code loses syntax coloring when importing project from Xcode 3 - objective-c

I have just upgraded to the new Xcode 4 and the code is not colored has it should be.
I am trying to use a project that I created on Xcode 3.
For instance, the string 'NSString' is not colored in my custom code, but when I switch to Apple's code (NSString.h for ex.) everything is well colored.
How can I fix that?
Thanks a lot,
Martin

Open the Organizer (Window > Organizer) and select the Projects mode. Select your project in the left-hand view and then click the Delete… button for the project's Derived Data.
This will delete the code sense index for the project and force Xcode to rebuild the index, which should fix the problem.

I got it to work by prefixing all my project search paths with "$(SOURCE_ROOT)/" instead of just using a project relative path. Eg "Include" becomes "$(SOURCE_ROOT)/Include".
Do this and then force a rebuild of the index by deleting the projects derived data from the organizer.

After trying most, if not all, of the steps above, I have succeeded in restoring my colorful Xcode eye candy by finding and deleting (in Finder) all of the derived data created from my project (there were several folders for my project that were lingering even after deletion from the Window > Organizer menu).
My project's folders that needed deletion were located in ~Library/Developer/Xcode/DerivedData

Also try this, select all(command + A) from your Prefix.pch file -> cut it(command + X) -> Build(command + B)(don't worry for error) -> paste(whatever you copy from Prefic.pch file in that file only)(commmand + V) -> Build again (command + B).

Try Product -> Clean and then Product -> Build

Remove the files from your project (just remove, don't delete them!) and re-import them.

Its possible that the permissions on the folder where Xcode stores the code-sense cache is broken. If the cache cannot be correctly written or read when you launch Xcode, it will behave as you describe.
Try locating the folder (you can locate it in the organizer. Hit the arrow next to the path.) and reset its permissions in the Get Info dialog.

There is another cause for this issue, it had been happening to me with beta versions of Xcode, you need to check that the .m file is added to the target in order to make it add color to the classes and enable the autocompletion.
You can check it out in the Xcode inspector
Hope this helps,
best regards,
Jorge.

Related

Appcelerator Studio indexes very slow

Once in a while Appcelerator Studio starting task "Building workspace... " and it shows that it indexes "/iphone/hyperloop/..." or "/android/hyperloop/..." even though I've disabled hyperloop in my project. Does anyone know how can I get rid of this long indexing? It takes like 20 minutes and makes no sense to me.
Thank you!
You can disable the automatic build under "Preferneces - General - Workspace - Build automatically" or inside the Project menu disable "Build automatically". If you still have the problem you could file a ticket at https://jira.appcelerator.org/secure/Dashboard.jspa
Exclude these folders from the project tree by adding Resource filters. Add Exclude All resource filter type to root folder of your project. You can also use regular expressions if needed.
This will avoid indexing the excluded files and folders, hence it will improve the performance.
Steps:
Right click on the project
Click on the project
Go to Resources -> Resources Filter
Click on Add Filter...
Select "Exclude All" from the Filter Type section
Select "Folders" from the Applies to section
Enter "modules" in the textbox as shown below
Appcelerator Studio is dog slow and I suggest to use another editor. The editor is Eclipse-based I believe, but as long as it exists it has had performance issues. The build options that are built into the appc studio can be called using the command line (appc ti build ...).
I deleted all the previous module versions of hyperloop and facebook.
Go to:
Library>Application Support>Titanium>modules
Look in:
iphone>hyperloop
iphone>facebook
android>hyperloop
android>facebook
I deleted all previous modules in those folders, keeping only the latest.

Xcode 6 Swift code completion not working

Using Xcode 6 GM seed my code completion has stopped working. It was working the other day. I was trying to get the unwind segue work around to work. I had made an Objc header file and assigned it as a header for a Swift class.
At this point I get code completion with an Objective-c project. But, not with a Swift project.
I have tried restarting Xcode, making a new empty project.
Just go in user->Library->Developer->Xcode->DerivedData and delete the Data of folder(Derived data) and restart Xcode.
This fix from apple dev forums works for me. I have had autocomplete issues with Xcode 6.1/Yosemite.
Quit Xcode.
Restart the computer (this is to clear any in-memory caches).
Delete the contents of the DerivedData folder (~/Library/Developer/Xcode/DerivedData), precisely run, a) cd ~/Library/Developer/Xcode/DerivedData/
b) rm -rf *
(Try this if Steps 1-3 dont really work as it rebuilds the cache later on restart which takes time) Delete the contents of folder ~/Library/Caches/com.apple.dt.Xcode, i.e., a) cd ~/Library/Caches/com.apple.dt.Xcode b) rm -rf *
Now launch Xcode once more…
I experienced a serious breakdown of code completion because I had some 'notes' after the #end statement of my .m file which were as follows:
/*
NSAlertFirstButtonReturn, NSAlertSecondButtonReturn, NSAlertThirdButtonReturn
*/
These lines can appear before the #end statement without destroying code completion.
There's an easier way to delete the Derived Data from within Xcode (no need to open finder or restart):
Xcode Organizer -> Projects -> (Your Project) -> Delete Derived Data
I just recently had this problem. Autocomplete did not work ...and when i typed for example tableView.... it did not give me the different functions available.
I tried the following and it worked for me.
Xcode Organizer -> Projects -> (Your Project) -> Delete Derived Data
delete the file ~/Library/Developer/Xcode/DerivedData/ModuleCache
Restart xcode
Hope this works
Another possible reason why it isn't working is because it's not part of the target membership. To fix this, select the file you're working on. Then, go to the File Inspector and in the Target Membership section, make sure your project is checked.
Try the following - as silly as it may sound:
Change Device to iPhone 6, close Xcode, Reopen Xcode and wait for the indexing to finish.
Go to Xcode menu, then Window -> Organizer, then select Projects. Pick your project and press on delete button beside dervied data
Then restart Xcode
That solution worked with me on Xcode 6.1
If your code completion problem is only with UI classes (e.g. UIImage, UIDevice), then you just need to add "import UIKit".
Swift files will NOT have code completion for UI classes unless there is an "import UIKit".
I had the same issue but under different circumstances,
I have 2 projects in my workspace
Swift framework for iOS and OSX
iOS Project (which uses the swift framework)
My code completion works fine in iOS but it keeps failing in the swift framework. I tried all the about solution and had no luck and was killing my productivity.
Finally i figured out the solution to this problem.
Select the file you are editing (in the framework )
Select the 'utilities' tab on the right
uncheck the Mac target (just keep the target you are working for
currently)
Thats it, this solved my problem.
hope it helps someone who is in this kinda situation.
user/Library/Developer/Xcode/DerivedData Delete all the files shown in this folder. after that go to your project name and clean project then come back to the file where you wanna see suggestions. Type any word and its done.
So all you have to do is make sure, in the file inspector view on the right side, under Target Membership, the first box is checked. I'm not sure why this changes things but I'm sure someone can come along and give a more complete answer.
In my case Some File(s) were deleted in File System but were still referenced in the Project i.e. in Red Color. Just delete those from Project and everything was fine. Code Completion started working.
Also Like to point that all the above answers about Clearing/Deleting Derived Data folder seems to work momentarily but whenever there was a new pull or update the problem started again, so the root cause was the unreferenced/moved/deleted files which show up as RED in the project, they needs to be manually cleared.

Refactor rename broken in Intellij IDEA

Somehow, I managed to break my refactoring capabilities in Intellij IDEA 12. I have somehow disabled it for my project. Renaming a member through Shift+F6 doesn't work. The inline edit box is not drawn, nothing happens.
I know of the refactoring settings in Settings -> Editor, Enable in-place mode and Preselect old name are both checked.
It has to be some kind of project setting. I checked by creating a test project, adding some member and renaming it, which works perfectly.
What setting am I looking for? Or could my project be broken?
There is no way to turn refactoring off in the settings. My guess is that the project's cache/indexes are corrupted. I had a case once where refactoring, especially renames, stopped working. A re-index solved it for me. Go to File >Invalidate Caches, invalidate your caches, restart IDEA, and let IDEA re-index the project (progress is shown in the bottom status bar right of center). Then try the refactoring.
If that does not solve it, take a look in the logs (Help > Show Log) and see if there is any indication in there as to the cause of the issue.
Fo all the MacOS users, do not forget to access Settings -> Keyboard and turn on the flag for the option Use all F1, F2, etc. keys as standard function keys. E.g.:
Otherwise IntelliJ will not get the focus to use the F4 key.
Following step worked for me:
From your IDE, go to: Preferences -> Project Structure -> Add Content Root, then select the folder you want to use.
None of the above steps worked for me in IDEA 2021.2.4 (Ultimate Edition). I got the following error message when trying to rename a file and its usages:
Cannot perform refactoring. Selected file is not located inside the project.
Instead, I had to create a new module.
File > Project Structure > Modules > Add (+) > Import module > Select <root_folder_of_your_project>
This reindexed the whole project, which took a couple of minutes, and restored the Refactor > Rename functionality.
waite for some time it can be due to running Indexing

How to delete projects in IntelliJ 12?

I created some dummy projects. Now I don't see any way to delete the projects that I don't want. Per this suggestion I can delete files, the project is going away but there is traces of it still available. For example, on the Recent Projects you can still see the name of the project you just deleted. So I am thinking there should be another (and really easy way) to delete a project.
Press the Del (or fn and delete) key to delete a project from the Recent Projects list.
Vote for this issue to make it more obvious and user friendly.
close project first, or until this dialog appear, then hover your mouse on project you want to delete from history, then press Del
you'll be asked for confirmation
On occasion, even with deletion of the project, some tidbits are left behind in the following Windows paths:
C:\Users\username.domain\.IntelliJIdea2017.1\system\compiler
C:\Users\username.domain\.IntelliJIdea2017.1\system\compile-server
C:\Users\username.domain\.IntelliJIdea2017.1\system\frameworks\detection
C:\Users\username.domain\.IntelliJIdea2017.1\system\conversion
C:\Users\username.domain\.IntelliJIdea2017.1\config\componentVersions
C:\Users\username.domain\.IntelliJIdea2017.1\config\tasks
This has been proven to be problematic - for example, if a new project is created using a previously deleted project name, it will create the project with data stored in the above paths, at least, this has been my experience.
The only way to TRULY delete the project is to get rid of all the garbage left behind in the aforementioned folders. I would suggest using Search Everything to find more tidbits left in the users temp folders.
In case your project is imported as a module, you can also go to File --> Project Structure and click 'Modules' in the left section. Now you can hit the minus button to remote the module from the project.
You can also click File -> Open project ...
When a file menu appears, you can right click the unwanted project folder and select Delete.
Just figured, I am using Idea Community edition 13.1.1 and the cleanest and easiest way is to go to File > Reopen project > Clear List. I just stumbled upon this menu today. I always thought that is just to clear the latest projects from the view inside the IDE and just realized it is clearing the projects from the main Dialog too.
-VRS
Also, in IDEA 13.x.x you can go File-> Close Project and you'll land in the window with Recent Projects tab. There pressing Del of Fn + Del on selected project helps .
On OSX Mountain Lion and IDEA 14, with the project open and focused, you can go to file -> close project, then delete the project from your filesystem. This removed all references to the project.
Note that if the project you are deleting is the only project open, closing it will show the welcome dialog, which will still show the project. Deleting the project manually from within your operating system is the next step, and the project will still appear in the welcome dialog until it is closed and shown again, usually by opening another project from the list, or quitting and restarting IDEA.
In my case, I had to delete home/.IntelliJIdea2017.2/config/options/recentProjects.xml
. In my file system (Ubuntu) this file appeared for some weird reason not writable and hold a list of projects I couldn't get rid of. Deleting this file and restarting will force Intellij IDEA to create a new one with an empty list of projects.
All you have to do is go to file - close project - to avoid seeing them again in the menu list and then you delete them from the projects directory.

XCode 4 Autocomplete with C++ library?

I am using Cocos2D Box2D template for my project.
When I type , "b2**" the autocomplete doesnt show any Box2D classes. (pressing ESC also doesnt show any )
I have included Box2D.h and Cocos2d.h in "Prefix.pch" file.
Is there any feature like "rebuild index" in "Eclipse CDT" ?
Any tips?
You can force Xcode to rebuild index by deleting it's service folder (DerivedData for Xcode 4.x):
Close Xcode
Remove service folder
Open your project and Xcode will rebuild index again
In my case this always works and I can call b2... autosuggest.
The DerivedData folder can be found in ~/Library/Developer/Xcode/DerivedData
This may be an obvious suggestion, but have you tried to type out a class that you know exists with what you have included, and see if it recognizes it(With both colorization and/or quick help)? Also, do you have the necessary frameworks included, etc? As far as reloading goes, the only thing that you can do in XCode that I know of is clean(shift+cmd+k) and re-build. Are you getting any sort of warnings, errors, etc? Another potentially obvious issue, is XCode set to c++ as the language? Anyways hopefully you haven't already tried all of this and it helps you get somewhere.
Assuming you're using XCode 4, you can rebuild the index rather simply:
Open the Organizer (Command+Shift+2)
Click 'Projects' in the top section
Select the project you want to rebuild the index for in the left sidebar
Click 'Delete' next to 'Derived Data' in the center portion of the Organizer
This is easier than traversing through the directories and manually deleting a series of folders.
This page lists the steps another user went through to get code completion working for Xcode 4 and Box2D – the steps include deleting the derived data folder, but also changing user header search paths, making sure there were no spaces in the path to the project, and other things. Some of these steps may be random or unrelated, but apparently they fixed the problem for two people on that forum.
Combining all the above posts together, this is how I went about solving my issue:
1) Make sure that all files are in 1 folder. This may sound obvious, but I had my Box2D files not in the same folder as my other code. When creating a new project with XCode, it creates a folder with the name of your project, then another folder within that that has the name of the project again. Example: "{path of project}/TempProject/TempProject". I had my Box2D files in the first TempProject directory and not with the rest of my code that is created under the sub-directory of TempProject.
2) Open your project's settings by double clicking your project in XCode
3) Scroll down to "Search Paths"
4) Edit the "Header Search Paths" value to be: ${SOURCE_ROOT}/${PROJECT_NAME}/** (Note: If your Xcode does NOT create a subdirectory like mine does "TempProject/TempProject", then just use ${SOURCE_ROOT}/**)
5) Delete your project's Derived Data by doing 1 of the 2 following ways:
a) Open Organizer -> Select Projects -> Select your Project -> Select Delete next to Project's Derived Data
b) Open Finder -> Select Go from the toolbar -> type in "~/Library/Developer/XCode/DerivedData" -> Find and Delete desired project's folder
6) Restart Xcode
7) Clean and rebuild code
8) Code sense should now work!