On Apr 30, 2015, at 13:29 , William Squires <[email protected]> wrote: > > If I understand properly, you can't have a circular #import
You can in the sense that if A.h #imports B.h, and B.h #imports A.h, then B.h can only see the contents of A.h up till the point that it #imports B.h. It’s circular (and therefore doesn’t produce the desired effect), though it’s not recursive like #include can be. On Apr 30, 2015, at 13:07 , Alex Zavatone <[email protected]> wrote: > I'm including a .h file in my iOS app's AppDelegate.h. Say it's XXXX.h > > Right below the #import in the @interface, I've got an iVar of that class. > > And below the @interface, a property that's nonatomic and strong for an > instance of that class. > > Xcode just started telling me that this class that I'm including is of > "Unknown type name" on the lines where the iVar and the property are defined. It would be easier if you could just show a code fragment, because we have to guess what “below” means. Inside or outside braces? Before or after the @end? In any case, you’ll have an easier time of it if you don’t #import XXXX.h in situations like this. Instead, use a forward declaration of the class: @class XXXX; Also, don’t declare ivars in .h files. Put them in braces after @implemention in the .m file. The cases where you must #import XXXX.h are restricted to these (or similar): — if XXX is a superclass of the class being declared — if XXXX.h contains non-class declarations (typedefs, enums, etc) that are *used* in the @interface section of AppDelegate.h. _______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/xcode-users/archive%40mail-archive.com This email sent to [email protected]
