In the dealloc method for a class how would I print out the ID (or some other unique identifier) for the instance being deallocated?
- (void)dealloc {
NSLog(@"_deallocing: ??");
[super dealloc];
}
Is this possible? I am just trying to get a little more feedback in the console as an aid to learning.
many thanks -gary-
If you specifically want the memory address of the object (which I suppose could be considered an "identifier" if you don't have one implemented in your class), you can use this:
NSLog(@"deallocing %p", self);
This can be rather helpful if you have more than one instance of a particular class and are trying to determine which is getting dealloc'd when.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With