Reputation: 614
I have four screens that are exactly the same except they use four different classes. I thought I could reduce them to one by putting this property in my header:
@property Class *classType;
Then I could set the class and be done.
HOWEVER, when I try to use classType like the following:
NSArray *myArray = [classType allobjects];
I get the following: "Bad receiver type __unsafe_unretained Class *"
This really doesn't make much sense. The class method returns and NSArray. When I use the explicit class name there is no error and everything works fine.
I'm using xcode 4.5 with ARC.
Upvotes: 1
Views: 504
Reputation:
Quick search on Google, even better in the runtime's headers:
typedef struct objc_class *Class;
The Class
type is a pointer itself - you don't need an extra *
sign when declaring the property.
Upvotes: 0
Reputation: 8492
Try using
@property Class classType;
Note the missing *. Class is like id, the pointer type is implied.
Upvotes: 4