I want to have an ivar of type Class and keep the pointer around after passing it. But no matter what I do, arc will not let me do this. For example, if I declare
@property (nonatomic, strong) Class myClass;
the compiler decides that myClass should be unsafe. And if I try this:
-(id) initWithClass: (Class) passedInClass {
if ((self = [super init])) {
self.myClass = passedInClass;
}
return self;
}
what happens is that even if the class is not zero in the calling code, it is zero in the init method.
Finishing off the arc, is there a way around this?
EDIT: This question is simply incorrect. He works. See Accepted Answer.
source
share