Why doesn't OCMock see class methods in extensions?

痞子三分冷 提交于 2019-12-23 00:28:31

问题


I am using UIAlertView+Blocks from https://github.com/ryanmaxwell/UIAlertView-Blocks, which adds a tapBlock property to UIAlertView, with OCMock.

   id mockView = [OCMockObject mockForClass:[UIAlertView class]];
   [[[mockView stub] andReturn:mockView] alloc];

   // this works
   [[mockView expect] setTapBlock:OCMOCK_ANY];

   // this doesn't, it doesn't know what tapBlock is
   [[mockResetPasswordView expect] tapBlock:OCMOCK_ANY];

The tapBlock is declared as @property (copy, nonatomic) UIAlertViewCompletionBlock tapBlock. I also would like to expect this to be called and delegate back to the original method.

来源:https://stackoverflow.com/questions/21219938/why-doesnt-ocmock-see-class-methods-in-extensions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!