If I use a category which uses objc_setAssociatedObject
to add pseudo-properties to an object, how can I make sure they get released properly? Do I have to release them manually in dealloc
?
Although you answered your own question, still, since you didn't include the docs text itself, and the page you linked to is no longer available, here it is for convenience of others:
From Apple's Objective-C Runtime Reference
void objc_removeAssociatedObjects(id object)
Removes all associations for a given object.
The main purpose of this function is to make it easy to return an object to a "pristine state”. You should not use this function for general removal of associations from objects, since it also removes associations that other clients may have added to the object. Typically you should use
objc_setAssociatedObject
with a nil value to clear an association.
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