"Expected specifier-qualifier-list before XYZ"

I run into this error from time to time and it always takes me a while to work out (again) what causes it.


It's caused by importing a class (abc) that then imports its importer (xyz) which then imports abc again which then imports xyz and so on and so forth. Meaning that we have introduced a circular dependance into our code.


Use the @class declaration in the .h file and save #import for the .m file. This is because @class is a class-forwarder that only makes the class its used in know about that the other class exists but doesn't include it. Where as #import pulls the imported classes code into the file.

What do you think? Let me know by getting in touch on Twitter - @wibosco