Skip to content
Jon Reid edited this page Sep 12, 2015 · 3 revisions

How do you express "any CGRect" when verifying a method argument?

Use withMatcher:forArgument: to specify matchers for specific arguments. Those matchers will take precedence over what is specified later. For example:

[[verify(mockObject) withMatcher:anything() forArgument:1]
    someMethod:arg someRect:CGRectZero];

Here, the matcher for the CGRect has already been specified as anything(). The value of CGRectZero is ignored, but some rect is necessary to create the right method signature.

I'm getting "-[NSInvocation mkt_retainArgumentsWithWeakTarget]: unrecognized selector sent to instance"

Add -ObjC to your Other Linker Flags.