Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create NSManagedObject Subclass... make a new Error in my project

i want to add a class for my entity by Editor\Create NSManagedObject Subclass... menu . but when i added it , the project made an error , this is the message:

Multiple commands produce '/Users/mohsenkhodadadzadeh/Library/Developer/Xcode/DerivedData/walk-fcnteanemrfigmfaalqkvwigvwqc/Build/Intermediates.noindex/walk.build/Debug-iphonesimulator/walk.build/Objects-normal/x86_64/WalkEntity+CoreDataProperties.o':
1) Target 'walk' (project 'walk') has compile command for Swift source files
2) Target 'walk' (project 'walk') has compile command for Swift source files


Multiple commands produce '/Users/mohsenkhodadadzadeh/Library/Developer/Xcode/DerivedData/walk-fcnteanemrfigmfaalqkvwigvwqc/Build/Intermediates.noindex/walk.build/Debug-iphonesimulator/walk.build/Objects-normal/x86_64/WalkEntity+CoreDataClass.o':
1) Target 'walk' (project 'walk') has compile command for Swift source files
2) Target 'walk' (project 'walk') has compile command for Swift source files

i changed that build system to Legacy Build system in File->Project settings . but it diden't work yet

this project made with xcode9 and i develope it with xcode 10 now

like image 582
mohsen Avatar asked Nov 01 '18 15:11

mohsen


People also ask

How do I create a subclass in NSManagedObject?

From the Xcode menu bar, choose Editor > Create NSManagedObject Subclass. Select your data model, then the appropriate entity, and choose where to save the files. Xcode places both a class and a properties file into your project.

How do I get NSManagedObject?

Still inside the Core Data editor, go to the Editor menu and choose Create NSManagedObject Subclass. Make sure your data model is selected then click Next. Make sure the Commit entity is checked then click Next again.

What is @NSManaged?

You use the @NSManaged attribute to inform the Swift compiler that Core Data provides the storage and implementation of a declaration at runtime. Add the @NSManaged attribute to each property or method declaration in your managed object subclass that corresponds to an attribute or relationship in your Core Data model.


1 Answers

Select the xcdatamodeld file in the project navigator, select the entity and press ⌥⌘3 – in Xcode 13 ⌥⌘4 – to show the Data Model Inspector.

If you created the class manually the Codegen popup must be set to Manual/None otherwise the class file is created implicitly.

like image 55
vadian Avatar answered Sep 25 '22 01:09

vadian