Xcode 11 doesn't recognize Core data Entity

前端 未结 4 913
轻奢々
轻奢々 2020-12-31 20:33

I just declared an entity called \"Users\" array:

var UsersArray = [Users]()

I got this error:

use of unresolved id

相关标签:
4条回答
  • 2020-12-31 20:34

    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.

    0 讨论(0)
  • 2020-12-31 20:38

    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.

    0 讨论(0)
  • 2020-12-31 20:52

    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:

    1. In the Project navigator, select your .xcdatamodelId file
    2. In the Configurations section, select the appropriate configuration
    3. Look for the entity in question and make sure the class name is correct (in my case, the entity and the class were not the same)
    0 讨论(0)
  • 2020-12-31 20:55

    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..

    0 讨论(0)
提交回复
热议问题