Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode Not Immediately Recognizing New Classes (iOS)

I've been working with Xcode for about 5 months now and I just recently ran across a problem when I add a new class. If I add a new class, say for example "CustomCell" and I try to import '#import CustomCell.h' into a different .m file it will give me an error saying 'CustomCell.h file not found' even though it's right there on the list. I've had no problem with this in the past and I know what I'm doing when it comes to importing (at least I haven't changed the way I previously went about it when it worked).

I've had this problem more than once recently and sometimes if I just close out XCode and restart it it will recognize the class. Has anyone else had this problem? Is there a quick way to just refresh the project to see if Xcode can recognize the new class?

like image 316
MillerMedia Avatar asked Nov 28 '11 17:11

MillerMedia


3 Answers

Close all your projects, open the organizer (from the window menu), make sure the correct project is selected, then opposite 'derived data' click delete.

After that, close xcode, re-open it, open your project, clean it, and everything should work okay.

like image 66
TigerCoding Avatar answered Nov 15 '22 13:11

TigerCoding


Multiple Targets: Make sure your file belongs to the necessary targets!


For a new file, make sure the appropriate targets are checked.

xCode Screenshot


For an existing file, check the file inspector to verify target membership.

xCode Screenshot

like image 18
Derek Soike Avatar answered Nov 15 '22 14:11

Derek Soike


Fixed, in my case when creating new methods for my class, the other class called test did not see these methods because the target was missing. Thank you

like image 1
Christian Prada Avatar answered Nov 15 '22 14:11

Christian Prada