Re: Unknown name type for an imported class in Xcode 6.x iOS 8 project
Re: Unknown name type for an imported class in Xcode 6.x iOS 8 project
- Subject: Re: Unknown name type for an imported class in Xcode 6.x iOS 8 project
- From: Quincey Morris <email@hidden>
- Date: Thu, 30 Apr 2015 21:57:18 +0000
On Apr 30, 2015, at 13:29 , William Squires <email@hidden> 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@hidden> 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@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden