I'm writing an app for the iOS in XCode 4 and stumbled upon an issue with #import statement.
All my source files are organized in folders, every folder is mapped to the group or subgroup in XCode. Consider the following:
ProjectFolder
-SubFolderA
--FileA.h
-SubFolderB
--FileB.m
Usually, if I want to import FileA into FileB, I write #import "FileA.h"
, and it works perfectly. But sometimes I have to write relative path, like #import "../SubFolderA/FileA.h"
. What should I do to be always able to write only name of the file?
This behavior seems undetermined to me.
PS: I don't want to keep all this mess in one root folder.
PS#2: Yes, I know how the 'folder' differs from 'group'. I've created folders on the early stage of the project, dragged them from Finder to XCode and mapped them to groups. And everything worked just fine - I was able to import headers using only filenames.
Most caches are stored in ~/Library/Caches, including the Xcode cache. You'll find Xcode's cache at ~/Library/Caches/com. apple.
It means they are not found on disk where your project believes they should be. Control-click and Show In Finder to see the folder location to locate the file and drag it back in to the project, and delete the bad reference.
Press and hold the ⌘ + shift and . keys at the same time. Then you can switch to view hidden/non-hidden files. Save this answer.
Importing into Xcode Open Xcode and select Open Another Project or File, Open. Open the folder you unzipped from your Dropsource download and locate the file with “. xcodeproj” extension in the root directory. Select the file and click Open.
Search "Scan All Source Files for Includes" in your project's and target's build settings and change the value from "NO" to "Yes". It will solve this issue.
You can always set the "Header Search Paths" under build options to specify which directories to search in. Don't confuse folders and groups though. They are completely independent. In particular groups are simply a convenience that allow you to organize your files within Xcode.
XCode is very much like iTunes in some respects, it wants to manage your files and hide them from you. When you create a group in XCode it's appearance is that of a 'folder' but if you go into the actual project folder you'll still see files everywhere.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With