I’d like to write an iOS unit test for a dealloc method that (basically) removes the object as the delegate of another object.
- (void) dealloc {
someObject.delegate = nil;
}
However I can’t call dealloc directly when using ARC. What would be the best way to write this unit test?
Assign an instance to a weak variable:
The instance will be dealloced right away.
Alternatively, you can disable ARC on your unit test file and call dealloc.