Classes folder not appearing in Groups & Files Xcode - iphone

The code files have suddenly disappeared from the left tree pane on my Xcode. I tried to drag and drop the classes folder from the file system but this starts giving syntax errors.
Please help.

If the project builds then you haven't deleted them, you've probably dragged them into another group[ by mistake :)
Open all the other groups and you might see the Classes folder as a subfolder. Just drag it back out again.
NB Go to Build->'Clean all Targets' and then build it again. If it builds without errors then my answer is probably right. If it doesn't build then I'm absolutely wrong :)

Related

How to correct the Xcode bug of creating lproj folders in the en.lproj folder?

I had a Localizable.strings file in my project for which I wanted to add more localizations.
So I went to the Project Settings and clicked the "+" to add languages. Somehow I cannot do that anymore on the right panel as there is no "+" button.
Xcode creates the cn.lproj folder inside the en.lproj folder in the file system which is messy but some other lproj folders such as de.lproj do get created where they belong.
How can I move an xx.lproj folder to where it belongs without breaking everything in Xcode? I am afraid leaving them where xcode is putting them can cause errors at run time because cn.lproj should not be a sub-folder of en.lproj.
As it turns out it's an Xcode bug, but fortunately it can be resolved.
First step is to backup your project. Then move the wrongfully placed lproj folders out of en.lproj and if you want, put all of them in a localized subfolder.
Then delete all the link-broken files (red) from the Project Navigator. For the stacked files that have an arrow you will have to delete the root item. Do not choose "Move to Trash". Then make sure in the Project Settings you have all the localizations you want. Drag the "localized" sobfolder containing all the lproj folders into Xcode wherever you want it to be, and make sure it gets added to the current target (Add to target checkmark must be checked in the list). In my case everything was functional as expected after doing this. And as a nice side effect I got rid of these annoying stacked files with the arrow and instead have a very clear group structure consisting of a localized and several lproj folders which makes much more sense to me.
The correct way to add a localization would be through your Project Info pane in Xcode.
It looks like this:
I would think trying to do it any other way might be asking for trouble (or hassle).
I think, you should have a folder en.lpoj for English.
Now if you click "+" and choose xx as language you should get another one named "xx.lpoj" nearby of the old one (on the same level so to say) and NOT inside the en.lproj.
So delete this wrong sub-folder and do it again ...

Drag and drop XCodeProj into another XCodeProj not giving me the option to copy

I'm trying to "install" core plot 0.4.
The first instruction is to drag and drop the XCodeProj file into my own project. I do this. Normally when I drag and drop images or the such like it asks me if I want to copy the file into my own project. However for some reason its not asking me, its just creating a reference.
I'm not sure what the difference is, and whether it will still work or not with a reference, its just the first instruction (http://recycled-parts.blogspot.com/2011/07/setting-up-coreplot-in-xcode-4.html) says to click the "copy into folder" checkbox.
However that whole dialogue doesn't come up. I drag and drop and it puts the xcodeproj into mine without anything happening!
confused lol
Thanks
Edit: My solution works, but the reason it works is in this answer: https://stackoverflow.com/a/5373575/264947
--
This is what I did to fix it:
Close Xcode.
Open Xcode and create a new workspace.
File > Add files to "Workspace".
Add the first project.
Build to make sure it builds correctly.
File > Add files to "Workspace".
Add the second project.
Build to make sure it builds correctly.
Drag one project into another.
Now, be careful with the next step:
Erase the second standalone project but choose **REMOVE REFERENCES. **
There. Now you should have one project as a dependent of another project.

Can't drag folder from one project to another in xcode4

I am trying to use facebook connect and you sare supposed to be able to drag and drop folders but it doesn't work in XCode 4! any ideas?
Update 1/8/2017: This is still true in Xcode 8.2.1
Previously:
drag folder from project A to project B.
Now:
1. in project A, right click - show in finder
2. finder - go up a level
3. drag the folder into project B
4. delete unnecessary files inside the newly added folder
Good job, Apple.
PS: And it doesn't work for groups, as #zeeple mentioned in comments.
Dragging resources between projects in XCode is generally a bad idea in my opinion, even if it is supported. When you drag and drop something in XCode, it doesn't actually create a new copy of that thing, it just adds a new reference to its old location.
This can be very bad, because now changing the resource in one project will make the same changes appear in the other. The vast majority of the time this is not what you want. SCM further complicates things, because if you add a resource to Project B by dragging from Project A and then check in the changes and then some other developer checks out just Project B, they will be missing the resources that you "added" to Project B.
So instead of dragging and dropping in XCode, I suggest using the Finder or the command line to explicitly copy your resources into the destination project's source tree. Then in XCode just add the copied files to the project the same way you normally would.

XCode uses an .xib not inside the project folder

I went back to an old project and recompiled it for OS 4.1 succesfully and ran it. I was asked to add a fourth tab to the Tab Bar, but I could not set its class to the newly added ModelsVC.h/.m. [edit: because it did not appear in the class dropdown, but the other viewcontrollers were there.]
I moved the project folder to a backup folder and unzipped a months old backup of the same project. It compiles and runs until the end of viewWillAppear for the first (default) view connected to the first tab, and then does nothing more. It is still running, but nothing is shown and nothing happens.
In the console, it says "Unknown class ModelsVC in Interface Builder file."
The problem is, that class didn't exist two months ago, so why should this way old project complain about it or even know about it?
I'd like to know where to look / tell XCode to use the .xib that is inside the project folder it is currently compiling.
And if it's path-related, how do I check what paths XCode looks in when a project is loaded/compiled?
For Xcode to run a .xib file inside the project folder, You can just open your xcode, add existing file and it is there.
I think the problem why the old project still runs is that it builds incrementally. That means when it builds the first time, the .xib file was there, and when it build the second time, it doesn't need to add and build the .xib file any more. So, in the second build, even if you delete and move out the .xib file, I think it still can build
Seems a 'sloppy copy' for whatever reason (such as a quick backup to try something experimental) of a project folder causes confusion. See this.

XCode - Classes folder set aside

I have lost my classes folder in Xcode and have discovered it has been 'Set Aside' and called Classes-1. How on earth did this happen and how do I undo it. There is no Classes folder in my project at all now and Classes-1 doesn't show up in XCode, only Finder. I can do nothing with the project at all except restore to a previous snapshot.
Help me please.
Create a group in Xcode - call it Classes. Add all files back again.