ios - How do I access the dealloc method in a class category? -
ios - How do I access the dealloc method in a class category? - i need perform action in dealloc method of category. i've tried swizzling doesn't work (nor great idea). in case asks, reply no, can't utilize subclass, category. i want perform action on delay using [nstimer scheduledtimerwithtimeinterval:target:selector:userinfo:repeats:] or [self performselector:withobject:afterdelay:] , cancel on dealloc. the first issue nstimer retains target, don't want. [self performselector:withobject:afterdelay:] doesn't retain, need able phone call [nsobject cancelpreviousperformrequestswithtarget:selector:object:] in dealloc method or crash. any suggestions how on category? i stumbled on solution haven't seen before, , seems work... i have category that--as 1 does--needs state variables, utilize objc_setassociatedobject , this: memento *m = [[[memento alloc] init] autorelease]; objc_setassociatedobject(self, kmementotagkey, m, objc_assoc...