0

in order to test a managed class I tried to create an instance in a unit test by first trying to mock NSEntityDescription and NSManagedObjectContext.

id mockEntityDesc = [OCMockObject niceMockForClass:[NSEntityDescription class]];
id mockManagedObjectContext = [OCMockObject mockForClass:NSManagedObjectContext.class];

But before I can get any further I get the following error when test is run;

Undefined symbols for architecture i386: "_OBJC_CLASS_$_NSEntityDescription", referenced from: objc-class-ref in CallsCoordinatorTests.o "_OBJC_CLASS_$_NSManagedObjectContext", referenced from: objc-class-ref in CallsCoordinatorTests.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Any advice please? Thanks

stan4th
  • 710
  • 1
  • 6
  • 19

1 Answers1

6

Your unit test target is not linking with the Core Data framework.

JeremyP
  • 84,577
  • 15
  • 123
  • 161