ios - OCMock throwing EXEC_BAD_ACCESS when used for child view controllers -
i have xctest case following code:
#import <xctest/xctest.h> #import <ocmock/ocmock.h> @interface childviewcontrollertests : xctestcase @end @implementation childviewcontrollertests -(void) testinitaddspassedcontrollersaschildviews { id mocktvc1 = [ocmockobject nicemockforclass:[uitableviewcontroller class]]; id mocktvc2 = [ocmockobject nicemockforclass:[uitableviewcontroller class]]; uiviewcontroller *controller = [[uiviewcontroller alloc] init]; [controller addchildviewcontroller:mocktvc2]; // fails if mocktvc2, mocktvc1 works. } @end
it's simple can make it. when run test, exec_bad_access deallocing mocktvc2.
if add mocktvc1 controller instead, works fine.
if swap order of mocktvc1 , mocktvc2 declarations, works fine.
if swap order of mocktvc1 , mocktvc2 declarations , change adding mocktvc1, fails again de-allocing.
so summation problem has declaring of second mock because no matter how order declarations, if attempt add mock declared second controller, fails when de-allocing.
can of guys quick cut-n-paste , see if occur well?
i'd confirm it's not setup.
thanks
Comments
Post a Comment