I am new to Objective-C, so it may be very simple, but I created a class that will store, among other things, a class reference. This is what I have in the .h file:
@property (nonatomic, assign) Class *filterClass;
Where I get to suck is that I cannot assign class objects to an instance of this class, I can somehow add them to arrays or variables:
Filter *filter1 = [[Filter alloc] init];
filter1.title = @"Sepia";
filter1.filterClass = [GPUImageSepiaFilter class];
I get an error message:
"Implicit Conversion of an Objective-C pointer to '__unsafe_unretained Class *' is prohibited by ARC"
It seems like he wants the filterClass property to be strong, but it also gives an error, because, as I understand it, you cannot define primitive types as strong. Obviously, I could just store the strings as class references and use -NSClassFromString, however it would be nice if I could just pass the objects of the class. Since I can put them in arrays, and it seems that this should be possible. Let me know if I am completely wrong.
source
share