I just declared an entity called \"Users\" array:
var UsersArray = [Users]()
I got this error:
use of unresolved id
If your entity is actually created, just close and re-open XCode. This works for me everytime. The other solutions, such as clean build, build etc, didn't work for me.
Other possible solutions:
(A) Re-launch Xcode
This is the solution that worked for me.
(B) Check if you did not forget to finalize your entity description
Typically: forgot to assign a type to one of the attributes (still "undefined").
(C) Clear derived data
Reason: The generated core data managed objects subclasses's source code files are in the project’s derived data location. Note: you might have to re-link your swift packages is using SPM.
Just ran into this issue after renaming an entity and figured I should post here how I resolved it.
Typically after making changes in the data model and getting compilation errors, I just do Product > Clean Build Folder, then Product > Build and that should take care of the errors.
However, the steps above didn't help this time. After scratching my head for while, I found the culprit with following steps:
Please try this solutions !!
Solution 1 :- Product->Buld for testing solved this issue for me(it solves most unresolved identifier bugs for some strange reason)
Solution 2 :- changing import Foundation to import UIKit. It seems like UIApplication isn't included in Foundation framework.
Solution 3 :- Highlight the Data Model, go to Editor -> Create NSManagedObject Subclass...
Hope this helps thank you..