为什么OCMock不会在扩展中看到类方法?

时间:2014-01-19 17:16:04

标签: objective-c ocmock

我正在使用来自https://github.com/ryanmaxwell/UIAlertView-Blocks的UIAlertView +块,它使用OCMock为UIAlertView添加了tapBlock属性。

   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];

tapBlock声明为@property (copy, nonatomic) UIAlertViewCompletionBlock tapBlock。我也希望能够调用它并委托回原始方法。

0 个答案:

没有答案