Hi,
I have an object Player which sets up some timers that I need to invalidate in the dealloc method but I realized this method gets never called:
I narrowed it down to a use case where I just load my players but do nothing with them so I though they should be released directly:
This code allocates the player, my internal timers in the player are started but they keep on running because the dealloc method does not get called. Why? I do not assign the player object to anything.
btw, I am using ARC
Thanks
I have an object Player which sets up some timers that I need to invalidate in the dealloc method but I realized this method gets never called:
Code:
- (void)dealloc {
if (statusTimer && statusTimer.isValid) {
[statusTimer invalidate];
}
}
I narrowed it down to a use case where I just load my players but do nothing with them so I though they should be released directly:
Code:
NSDictionary *searchResults = ... //get persisted data
for (NSArray *playerJsonArray in [searchResults allValues]) {
// here I allocate my player
Player *player = [self parsePlayerFromJSON:object];
// but do nothing with it!
}
This code allocates the player, my internal timers in the player are started but they keep on running because the dealloc method does not get called. Why? I do not assign the player object to anything.
btw, I am using ARC
Thanks
Last edited: