iphone - Unrecognized Selector SenTestCase for Category -


I created a new Cocoa Touch Static Library Project with Unit Testing in XCode 4 and added a category:

// NSString + Inflections.h@Interface NSString (implications) - (NSString *) plural; @end // NSString + Inflections.m @ implementation NSString (Inflections) - (NSString *) polygon (return self;) @ and

Then the appropriate import statement was added to my test cases And written the following exam:

  - (zero) testPlrealize {NSString * test = @ "person"; NSString * required = @ "people"; NSString * real = [test plural]; STAssertEqualObjects Actual, expected, @ "Whoops");}   

However, it failed with my tests (with 'sent to unknown selector') No) the cause of the accident.

How can I test a category inside a library?

I've compressed and uploaded the whole project if my description is insufficient.

I was looking for the answer to this problem myself and found (I believe) is a simple solution, for which there is no need to remember to add a reference to the compile source list, Whenever a new class category is added to the project.

In the build setting of the test target, add -ObjC to the linking / other linker flag value.

Further explanation for what happens due to this error.

Comments