I am working on this issue for a long time and can not get an answer, hope someone can help me out.
I have a ios ARC based app. It's strange that I got "[Not A Type class]: message sent to deallocated instance" from the below code only in iphone then the app just crashed, although it is working well in the simulator. I understand that it could be memory issue, but can not figure out why. After searching the forum, it seems it's related to CGColorRef, but I can not find the simliar case.
self.backgroundColor = CMConstants.greyColor;
CGContextRef context = UIGraphicsGetCurrentContext();
CGColorRef separatorColor = [UIColor colorWithRed:12/255.0 green:12/255.0 blue:12/255.0 alpha:1.0].CGColor;
CGRect paperRect = self.bounds;
That's because the UIColor is released after the call to
colorWithRed:green:blue:
because not used and it's causing your CGColorRef to not have any backing.Do this:
And when you're done: