Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kiwi Spec Unit Test: Instance method '-attachToVerifier:verifier:' not found

I'm building some Kiwi tests and getting a warning that I cannot explain. I'm new to Kiwi.

I have a mock object setup:

id conversationMock = [KWMock mockForProtocol:@protocol(Conversation)];
[conversationMock stub:@selector(end)];

And in my controller, a property called "conversation":

@interface MyController ()
@property (nonatomic, assign) id<Conversation> conversation;
@end

The mock is assigned to the property, then in the spec I check for whether the method "end" is called on the conversation:

it(@"should end conversation", ^{
  [[[myController.conversation] should] receive] end];
  [myController stopTalking];
});

The compiler (LLVM 3.0) is showing a warning: "Instance method '-attachToVerifier:verifier:' not found"

What is the cause of this? Is this something I need to fix? (test runs ok, checks the method call to end works ok)

like image 807
Jess Bowers Avatar asked Dec 15 '11 18:12

Jess Bowers


3 Answers

Typecasting the id to a NSObject gets rid of the warning:

[[(NSObject*)[myController.conversation] should] receive] end];

like image 135
Jess Bowers Avatar answered Oct 28 '22 17:10

Jess Bowers


What you need to do is:

build settings -> Other Linker flags

Add the flag: -all_load

like image 21
Komposr Avatar answered Oct 28 '22 17:10

Komposr


Based on @Komposr's answer, I looked at a couple of my projects with Kiwi and found that I needed to do the following:

Build Settings -> Other Linker Flags

add the flag: -ObjC

Note that I am NOT USING CocoaPods. I have downloaded and compiled Kiwi as a static library that I am including...

like image 31
cesar Avatar answered Oct 28 '22 19:10

cesar