'Class' is ambiguous for type lookup in this context
Asked Answered
K

7

18

I did a core-data model:

class Order: NSManagedObject {
    ... //code
}

but when I try to build I get an error:

'Order' is ambiguous for type lookup in this context

Kismet answered 25/9, 2018 at 10:59 Comment(0)
K
27

so I figured - the Entity 'Order' should be defined in the core data properties panel.

  1. open core data .xcdatamodeld file

  2. select the Entity 'Order'

  3. On the right select "Current Product Module" under module

  4. select "Category/Extension" under Codegen

enter image description here

Kismet answered 25/9, 2018 at 10:59 Comment(2)
This is not working anymore.Gangrel
Working when you use Manual/None @GangrelOrnithopter
K
11

Below are steps that worked for me,

  • Delete "NSManagedObject" files created
  • Clean build
  • Open core data .xcdatamodeld file
  • Open the right pane by selecting "Entity"
  • Set Module to "Current Project", Codegen to "Module None" Setting One Ref Image
  • Now go to Editor Menu from the top and create a subclass "NSManagedObject"
  • Build the project
  • Go back to Enity right pane and change Codegen to "Class Definition" Setting Two Ref Image
Knockknee answered 19/2, 2023 at 10:0 Comment(0)
H
0

I feel the right solution is to delete the files created by Xcode foe the entity class and attribute class and change the codegen to class definition.

Homemade answered 23/9, 2021 at 11:57 Comment(0)
P
0

Make sure to clean your build folder also once you make the required changes to your entity settings.

Perorate answered 5/8, 2022 at 16:4 Comment(0)
B
0

I had the same issue, on codegen option i had choosen class defination,To fix this: 1.Delete the generated class files 2. Select the Order Entity and on codegen on your right hand side choose manual\none 3. Navigate to Xcode Editor and select "Create NSManagedObject subclass to generate the classes again.

Butterscotch answered 11/2, 2023 at 16:25 Comment(0)
S
0

In my case I had an entity named "Client". Client seems to be used internally under the hood somewhere. Changing the entity name to "Company" resolved the issue. So check if your naming is reserverd by the system or other components.
Be sure to change both entity and class name (at least the class name).
enter image description here

Sardine answered 23/8, 2023 at 8:51 Comment(0)
S
0

The accepted answer by @aviram-netanel worked for me, but I had a hard time finding the panel lol.

  1. Open your .xcdatamodeld file
  2. Click on one of your entities

enter image description here

  1. Press this button on the top-right of the screen

enter image description here

  1. Select the last tab and fill in this information

enter image description here

Spirituality answered 27/7, 2024 at 11:53 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.