I have a custom ProductCategory object.
.h file:
.m file:
#import "ProductCategory.h" @implementation ProductCategory - (id)init { if((self = [super init])) { self.parentCategoryId = 0; } return self; } - (id)initWithId:(int)productCategoryId name:(NSString*)name { if((self = [super init])) { self.productCategoryId = productCategoryId; self.name = name; self.parentCategoryId = 0; } return self; } - (id)initWithId:(int)productCategoryId name:(NSString*)name children:(NSArray*)chidren parentCategoryId:(int)parentCategoryId { if((self = [super init])) { self.productCategoryId = productCategoryId; self.name = name; self.children = chidren; self.parentCategoryId = parentCategoryId; } return self; } @end
This is an ordinary object, I have done it 100,000 times. The problem is that sometimes an instance of this object returns "0 objects" and sometimes returns the correct object.
For example, if I do this ProductCategory *category = [[ProductCategory alloc]init]; , sometimes it returns an instance of ProductCategory , and sometimes it returns "0 objects" , so I cannot assign any value to this object.

I think it must be something really stupid, but I donβt see it.
source share