I am trying to use OCMock's andDo with a block but every time I try it, I get EXC_BAD_ACCESS. Below is an example with NSNotificationCenter but I get the same result for other objects using blocks.
What am I missing?
[[[notificationCenterMock stub] andDo:^(NSInvocation *invocation) {
void (^block)(NSNotification *note);
[invocation getArgument:&block atIndex:2];
NSNotification *notification = [NSNotification notificationWithName:UIApplicationDidEnterBackgroundNotification object:nil];
block(notification); //EXC_BAD_ACCESS when calling this line
}] addObserverForName:UIApplicationDidEnterBackgroundNotification object:nil queue:[OCMArg any] usingBlock:[OCMArg any]];