Why won't Xcode recognize a typedef from a header that's being properly imported?
I got the same "Expected a type", and it turns out that it was caused by an imports loop. I reproduced it with the following simple example:
A.h:
#import "B.h"
typedef enum {
SomeEnumA
} SomeEnum;
@interface A : NSObject
@end
B.h:
#import "A.h"
@interface B : NSObject
- (void) func:(SomeEnum)arg;
@end
The compiler complains about SomeEnum unknown in B.h - while compiling A.m (which just imports A.h). This happens because A.h imports B.h which imports A.h. The imports loop doesn't occur, so B.h in this case does not include the A.h code where the type is defined.
The issue can be easily solved by moving the definition of the enum to a separate SomeEnum.h .