OCMock의 andDo를 블록과 함께 사용하려하지만 시도 할 때마다 EXC_BAD_ACCESS가 발생합니다. 아래는 NSNotificationCenter의 예입니다. 그러나 블록을 사용하는 다른 객체에 대해 동일한 결과를 얻습니다.스텁 블록 인 경우 OCMock EXC_BAD_ACCESS
무엇이 누락 되었습니까? 너무 깊이, 그리고 더 많은 코드를 보지 않고이로 보지 않고
[[[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]];
같은 문제를 __unsafe_unretained와 함께. :( – BlueVoodoo