Yes, you have a circular import. The problem here is that the second import (the one that re-imports your first header) is basically ignored by the compiler, since it thinks it's already imported that header.
The solution here is to use @class
forward-declarations instead of using #import
s. Not only does this solver the circular import problem, but it's a better idea anyway since it breaks unnecessary dependency chains (e.g. if I edit OneClass.h, SecondClass.h won't need to be re-processed).
To apply this here, simply remove the #import OneClass.h
in SecondClass.h and replace it with @class OneClass;
In the more general case, you don't ever need to #import
a header file just to declare an ivar/property/method that uses a class from that header. The @class
token is sufficient. You do, however, need to #import
the header file if you're inheriting from the class, or if you're referencing another non-class type declared in that header. Also remember that if you use @class
in your header, you need to remember to put the actual #import
into your .m file.