Reputation: 8130
I've created a new project using default settings and including core data.
In the app delegate I get this error
"cannot import module being compiled" with coredata highlighted. what can i do to fix this?
Upvotes: 6
Views: 2437
Reputation: 1
I don't know why but this is my solution:
I renamed the project named "CoreDate" and even delete it and new a project named "CoreDataDemo", "CDdemo" and so on. But they don't work, the error is still there.
After that, I try to create project without adding it to the workspace I used before, the result is no error.
I suppose there's something wrong with my workspace because I have created a project named "CoreData". So I delete the whole workspace in which I create my projects and create a new workspace. And everything goes ok!
Upvotes: 0
Reputation: 2421
I found interesting thing, that there are two values in Build Settings: Product Name and Module Name. Usually they are the same, so you got this error cause your product name is the same as module name (so product name is compiled, and it can't import it as a module). You can name module name to something like "ProjectModule", in your case "CoreDataModule" and then use @testable import CoreDataModule
Upvotes: 0
Reputation: 4522
This is happening because you project has the same name as the CoreData framework, try renaming your project and it should work.
Upvotes: 23