0

I have a custom Core Data class called User, but when I tried to import the User+CoreDataClass.h file in my XCTest, it says that the file is not found, and it does not even show up. I have tried to search but most of the results are for Swift and not Objective-C. Does anyone know how to fix this in Objective-C?

enter image description here

To add more information,

User* user1 = [NSEntityDescription insertNewObjectForEntityForName:@"User" inManagedObjectContext:mainContext];

does not work because the User entity is not recognised.

Willeke
  • 14,578
  • 4
  • 19
  • 47
Beck
  • 5
  • 3
  • Did you share your file with test target ? – zeytin Jul 19 '21 at 14:05
  • Yes, I followed https://stackoverflow.com/questions/21911168/when-do-app-sources-need-to-be-included-in-test-targets and https://stackoverflow.com/questions/43140363/core-data-classes-not-generated-for-test-target and both do not seem to be working – Beck Jul 19 '21 at 15:26
  • Did you try the `@import` shown in that second answer? It's not in your screenshot. – Tom Harrington Jul 19 '21 at 16:35
  • Did u mean `@import "AppFileName"`? because it doesn't auto complete as well even though I've already set the test target to be testable – Beck Jul 20 '21 at 20:11

0 Answers0