I have a type defined like this in my Prefix.pch file.
typedef NS_ENUM(NSUInteger, ServerType) {
ServerType0 = 0,
ServerType1,
ServerTypeCount
};
I have a method declaration like this:
+ (NSArray *)allServersForType:(enum ServerType)serverType;
But I am getting warning
"Declaration of 'enum ServerType' will not be visible outside of this function"
and worse when I try to pass it like this:
NSArray *servers = [Server allServersForType:ServerTypeCount];
I get an error "Argument type 'enum ServerType' is incomplete"
What am I doing wrong?
Thanks in advance.
Rob
You've typedefed the enum so no need to specify enum
again.
+ (NSArray *)allServersForType:(ServerType)serverType;
Update taken from comments:
Add the declaration of the enum to the .h file of the class that declares this allServersForType:
method.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With