We have a construct like this (ARC code):
// load an object into an ivar using a block
self->objectLoader = [MyObject loadOnSuccess:^(MyObject *object) {
// reference self from the block, so self is retained
self->_object = object;
// try to dereference the loader
self->objectLoader = nil;
}
The problem is that the object never deallocates, because self is never fully released. If I replace self with a weakSelf version, the object deallocates successfully.
Is there a way to nil the ivar so that the block it's "holding on to" is released and the object can be deallocated?