I created a Server class with methods that use NSURLConnection's sendAsynchronousRequest:queue:completionHandler: method.
I set completionHandler: to a block that should run when the server returns, and in that block I try to use XCTAssertTrue but get the warning:
"Capturing 'self' strongly in this block is likely to lead to a retain cycle"
Now I've seen this warning before when trying to use 'self' in a block (and am guessing both problems are related?). Usually to silence these warnings you declare variables outside of the block or queue with __block or __weak. Then you can read from those variables in the block or assign a value to them and retrieve the value assigned inside of the block from outside of the block. So instead of just using self or self.player in one of my classes I would do this:
__weak FancyViewController *weakSelf = self;
__block Player *blockPlayer = self.player;
and use weakSelf and blockPlayer inside of the block to get rid of the errors.
What about XCTest methods? Can they be used in blocks or queues?