Can't Find Entity In Scope

My code was working perfectly and then all of a sudden I started getting an error, "Cannot find type 'MyEntity' in scope." It sees the Data File but for some reason, the entity is no longer visible. Has this happened to anyone before? Any ideas on how to fix it? I've tried everything. Thanks!

Where is WordEntity defined? I don’t see it in your code and it seems neither does XCode.

Hey, thanks for the reply! Yes, I should have posted a code example where "WordEntity" is defined, my bad. As you can see, the error still persists. I've double, triple, and quadruple checked everything. I copied and pasted "WordEntity" from the Data Model file into the definition to make sure it's referencing the correct file. I've restarted Xcode, restarted my Mac, and finally did a fresh uninstall and reinstall of Xcode. I'm at a loss.

Okay, I'm not sure I've identified the problem but I did find a solution, (at least one that works at the moment). It may have had something to do with the fact that instead of creating a unique project with a unique name, I replaced an existing project with the same name. After I created a brand new project with a unique name everything started working again. Xcode now sees the entity. So for the benefit of anyone who might run into this in the future, try creating a brand new project with a brand new name. DON'T USE THE "REPLACE" BUTTON. I'd even use different variable names just to be safe.

Thanks again!

1 Like
Terms of Service

Privacy Policy

Cookie Policy