cocoa - Objective-C: Why is my object being instantiated as __NSMallocBlock__? -
i running strange problem trying dynamically create new instance of class
property (arrayclass
) have set , stored previously:
nsobject *instance = [[self.arrayclass alloc] init]; if ( ![instance iskindofclass:self.arrayclass] ) nslog(@"say what?!");
if break , log self.arrayclass
, shows proper class on console (in case, called store
), when attempt create instance of dynamically , log type of instance, showing class __nsmallocblock__
.
what heck going on??
it turns out silly mistake indeed. had somehow created empty init
method in class trying instantiate, had forgotten implement (or return anything). strangely, compiler didn't complain this.
here's empty init method looked like:
- (instancetype)init { }
obviously since i'm not defining or returning self
, runtime doesn't object init
expects. does get, oddly enough, comes __nsmallocblock__
type, , trying pretty object result in crash.
Comments
Post a Comment