I’m getting weird EXC_BAD_ACCESS errors. I thought that I didn’t need to retain objects if I was didn’t need them after the method exited, but I want to double-check that. In the following, do I need to retain “tData”?
-(void)myMethod:(UITouch*)touch{
TouchData *tData = (TouchData *)CFDictionaryGetValue(datasByUITouch, touch);
[tData doSomething];
}
I think according to The Rules, what you’re doing there doesn’t require you to retain the tData object that scope. You’re not doing an init, alloc, new or copy, instead you’re using one of TouchData’s methods to return some data, meaning that the method of TouchData that you’re accessing is responsible for releasing the object.