Foundation class message is a forward declaration error

2.1k views Asked by At
NSHost *h = [NSHost hostWithName:name];

Im getting two errors from this line of code

ARC Issue: Receiver 'NSHost' for class message is a forward declaration. 
ARC Issue: No known class message for selector 'hostWithName:'

Googling around, I find that the forward declaration error is usually due to failure to include some framework. This situation is weird, though, because NSHost is part of the Foundation Framework, which is imported in my header file. And yes, my implementation imports my header file.

An opt+click on NSHost says that NSHost is declared in NSStream.h, not NSHost.h. The NSStream header file only declares @class NSHost.

Product => Clean doesn't solve anything either. I'm pretty confused as to what the issue is here :(

EDIT: I think the problem is that NSHost is not available for iOS :-/

1

There are 1 answers

1
bbum On

You should be #importing at the top of your file (or in your shared PCH).

Or, if you really really want to go the manual route, #import (assuming that file exists).