I\'m currently working with the XMPP Library for Objective-C, and I\'m using the \"Desktop\" example code.
It logs in fine; however, when I open a new chat, or someone s
In my project (as a mistake) there was a weak reference to self
in dealloc
(it was a separate method, called to clear used resource).
Using weak reference to one property of this object (that captured just a reference to the resource) solved the problem.
It is really strange to create weak reference to half-destroyed object in dealloc
.
- (void) dealloc
{
[self freeUsedResource];
}
- (void) freeUsedResource
{
__weak MyClass *weakSelf = self;
dispatch_async(self.queue, ^{
[weakSelf.usedResource freeUsedMemory];
});
}