Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is XCode giving me the error 'Reimplementation of class'?

Tags:

xcode

ios

XCode gave me a very unhelpful error about not being allowed to re-implement a class. I searched and I searched, and nowhere else was that class name implemented -- referenced, but not implemented.

I actually did a keyword search and went through every single line of my project that referenced that class, and didn't find anything that tried to implement it. (And, annoyingly, there's nothing online that helps with this particular error -- hence why I'm including the self-answer, to help the next person this happens to).

like image 969
RonLugge Avatar asked Dec 05 '25 05:12

RonLugge


1 Answers

The key, as I eventually discovered, was in a malformed include. I hit the wrong button when using autocomplete, and another class was including the .m file instead of the .h file -- with the result that I was, in fact, implementing the same class twice. Not because I was doing it in two places, but because I wound up actually trying to compile the same file twice!

like image 109
RonLugge Avatar answered Dec 06 '25 23:12

RonLugge