folder structure in xcode vs folder structure in finder - iphone

I have the following folder structure in xcode for a project.
However, I have the above file structure in finder.
Is there any way to reflect the file structure from xcode to finder ?

I recently discovered a Command Line Tool that will do exactly what you need. You can find it here:
https://github.com/venmo/synx
To install the tool, you just need to open the terminal and run the following command (use sudo to run it as a superuser and get permission):
$ sudo gem install synx
Then, just like the instructions on the GitHub webpage above indicate, use the following command to re-organize your folder structure:
$ synx path/to/your/project.xcodeproj
This should do it :).

You should managed it yourself in Finder, then set new Path for folders in Utility View

The "folders" in Xcode are actually groups and not necessarily linked to a folder in Finder.
You need to manage it yourself if you want a mirror in Xcode/Finder.
What you can do is create the folder structure you desire in Finder, then drag each folder into Xcode, this will create references to the folders as groups in Xcode and any files you create in those groups will be saved in the appropriate Finder folders.

You can do this to some extent! There's just one extra step to do every time you create a new group (and this first time you'll have a lot of catching up to do!):
Xcode 3: Whenever you create a group in Xcode, immediately get info on it, and notice the "Path:" setting just below its name. Click "Choose..." and set it to a new folder with the same name.
Xcode 4: Whenever you create a group in Xcode, immediately select it and open the righthand sidebar. Notice the "Path:" setting just below its name. Click the icon next to "None" (what is that, a file in a window?) and set it to a new folder with the same name.
Now, whenever you add files to the group, they'll head to the corresponding folder on disk. Woo!
Hence, I always create folder in Finder and then add that in Xcode.

Check out this article. It might help you organise your project.
http://www.blackdogfoundry.com/blog/xcode4-folder-structure/

After version 9 Xcode (haven't checked previous versions) handles this for you! As long as you create a group and you don't select "New group without folder" Xcode automagically creates a corresponding folder in your project that will be reflected in your project's file structure.

Related

Why doesn't Xcode recognize Main.storyboard?

I am running Xcode 9.2 on 10.13.3 and just today ran into a problem with Xcode not recognizing Main.storyboard on an app that I am building. It worked on Friday and then today when I opened the app to work on it I get the following error:
.../Base.lproj/Main.storyboard: Interface Builder could not open the
document Main.storyboard" because it does not exist.
Visually the file is there but does not respond. It is listed correctly in info.plist.
I tried pulling versions from Time Machine from last week and I still get the same error.
Is there anything short of rebuilding the storyboard that I can do to get Xcode to recognize it?
Did you try Removing the storyBoard and Re-Add it in Main Bundle ? Just make Copy of your Storyboard and Delete it from Xcode Project and Again Drag And drop the copy made in Xcode Project with check Copy items into destination group's folder (if needed)
And
Also check
Link - Interface Builder could not open the document ".storyboard" because it does not exist
Other options are Also Provided there
When you upload your file to google drive without zip, it appends the extension of .storyboard to .xml automatically and hence when you download it obviously the file won't exist. To solve this issue, go to the [project folder]>[Project folder]>[Base.lproj]. There would be a .storyboard.xml extension type of file which you would have to rename it to the .storyboard extension. And hence your work is done.
Story board error solving visual guide.
Delete derived data. The location is under xcode>preferences
Follow below steps:-
1.Save a copy of the affected file outside of the project
2.Delete the file from the project, selecting Move to Trash to completely
3.delete the file and reference from the project
4.Edit ProjectName.xcodeproj/project.pbxproj to remove all lines referencing the affected file Re-add the file, making sure to check
Copy items into destination group's folder (if needed)
5.Clean and build
Try opening Xcode and go to runner then double click on the main storyboard then uncheck runner , that worked for me.

'RevMobAds/RevMobAds.h' file not found

I am unable to find the problem of this Error. Can anyone guide me. How to fix given below error.
I had added the revmob sdk in my project and i had also checked the box "Copy to destination if needed." And i also checked it is there in the xcode project. but still given below error is not going. This not my first time i am integrated revmob. but do not know why suddenly this error starts appearing even this code is working fine before.
Error
'RevMobAds/RevMobAds.h' file not found
I call this the "Phantom Folder issue"...
I had an issue where I deleted the RevMobAds.framework from within Xcode but when I tried to re-add the newer SDK by dragging and dropping into Xcode into a different folder (copy was checked and targets were checked), it would appear then give me the same error: 'RevMobAds/RevMobAds.h' file not found
It turns out that when I checked the real project folder in Finder (not from within Xcode) that an empty RevMobAds.framework folder was left behind.
So what I did was:
(1) From Xcode, deleted the RevMobAds.framework that I had added.
(2) Went to the real project folder in Finder and deleted any phantom/leftover folders named RevMobAds.framework that were still there.
(3) Dragged the RevMobAds.framwork SDK back into Xcode (making to sure to check COPY and targets).
And this solved the problem for me.
Right Click on your App in groups and files section, Select Add files to "your app"....
Once you do that, select folder you want to add and select "Copy items into destination group's folder (if needed)" as shown in screenshot below.
Note: Copy items into destination group's folder (if needed) is to be selected only if the files are physically in some other folder and not the application bundle or application folder.
Ok, finally I managed to solve this. I read a lot of questions here, and searched online.
This article help me out a lot.
So, what happened to me, is that the library files, that were giving to me were missing some files and shortcodes.
So, I just:
Downloaded the new version of the library. Link here.
Copy to my project folder.
Add it to the Header Search Path. (Build Settings, Search Path, Header Search Paths. Add something like $(PROJECT_DIR)/RevMobAds.framework)
And a Clean, Build.
And that's it.

Xcode - resource already exists?

I'm simply trying to add a file to my Xcode resources folder and it fails claiming the file already exists, which simply isn't true.
I assume it has a record of the name and is confusing itself, I tried performing a 'clean' but this didn't help. Any ideas? Thanks!
click on project and get info.Then search for the file.And then delete it.
Try fully closing/re-opening Xcode and failing that, reboot yet?
Just to be sure, use the file filter at the bottom of the project navigator to triple check the file is not there.
If the file is definatly not in the project sometimes Xcode gets confused when you delete a file and the file may actually be on disk. So check the actual project directory on disk to ensure that your file is not in there.
Quick way to get to your project directory, right click the project file (or any file) and select Show in Finder or at the very top of the Xcode window cmd + click the project title and select the folder it is in.

Adding assets to Xcode problem

I've an Xcode project which has been using svn, but we had to stop using it. Since then when ever I try and Add files to the project I get the error window below. The files actually get added to the file system (using Finder), but not to the project,so not displayed in the file system in XCode and therefore can't be accessed.
I found the answer myself.
Just make sure you delete all the hidden .svn files / folders

Why can't I just send my zipped Xcode project folder to a friend, and it works?

I always use one folder on my filesystem for an Xcode project. It contains all project files. When I zip it and send it to a friend, she can't just ipen the xcodeproj file. It opens, but all paths are broken and build fails because all the classes don't find the #include'd files. But when I download i.e. some example projects from apple, these work perfectly. What am I doing wrong?
UPDATE:
I'm doing it like this:
1) I create a project and specify an directory on my desktop
2) In that directory I create an "images" directory and add images to it
3) I pull this images directory out and drag it into the Resources Groups&Files. Xcode asks if I want to copy it to destination folder, I click no. Because it's already there. All other things are set to default.
4) all other things are just created within xcode, and xcode just puts all classes in the Classes directory of my project.
5) when I want to add images, I first put them in the directory of the project, and from there drag them into the Images group in xcode. That's to make sure xcode doesn't mess them up with everything else. Otherwise it would just copy them to the root of my project directory rather than inside the Images directory, which doesn't make sense. In fact, the whole Groups&Files filesystem doesn't make sense at all, it's one big mess. Apple's biggest mistake in Xcode so far. That's why I have to do such stupid things.
We don't really know exactly what you're doing so it's hard to see what you're doing wrong.
Perhaps inspect the xcode project files directly, see if you have hardcoded paths. That's a sure fire problem. Make sure you copy resources into the project instead of referencing them externally, etc.
I expect that you have "search path" build setting set to an absolute path on your machine, rather than a path relative to the project. Best way to tell is to post a portion of the build transcript from the failed build and look at the -I directives. If those paths don't exist on your friend's machine, then they should be changed from absolute paths to paths that start with ${SRCROOT}.
Are you just trying to build on the second machine or are you trying to deploy to a device on the second machine? If you are trying to deploy to a device (iPhone or iPod Touch) then it probably has something to do with Code Signing and Certificates.