4 Replies
      Latest reply on Nov 21, 2019 12:05 PM by applegg
      applegg Level 1 Level 1 (0 points)

        MacOS 15, 14 target. Latest XCode.

         

        I created a new non-document CoreData app using XCode template. Added in two persistent classes, FileServers and Server, from another (previously working) app to isolate some issues. No other model objects. I get 4 errors, one for each class and meta class:

         

        duplicate symbol '_OBJC_CLASS_$_FileServers' in:

            /Users/gordonapple/Library/Developer/Xcode/DerivedData/SimpleSFTPClient-bknoaunyaxmtbnatoytyifidspjy/Build/Intermediates.noindex/SimpleSFTPClient.build/Debug/SimpleSFTPClient.build/Objects-normal/x86_64/FileServers.o

            /Users/gordonapple/Library/Developer/Xcode/DerivedData/SimpleSFTPClient-bknoaunyaxmtbnatoytyifidspjy/Build/Intermediates.noindex/SimpleSFTPClient.build/Debug/SimpleSFTPClient.build/Objects-normal/x86_64/FileServers+CoreDataClass.o

         

        Next attempt: Deleted the two managed object classes and used XCode's "Create Managed Objects Subclasses" and get:

         

        Showing All Messages

        Multiple commands produce '/Users/gordonapple/Library/Developer/Xcode/DerivedData/SimpleSFTPClient-bknoaunyaxmtbnatoytyifidspjy/Build/Intermediates.noindex/SimpleSFTPClient.build/Debug/SimpleSFTPClient.build/Objects-normal/x86_64/Server+CoreDataProperties.o':

        1) Target 'SimpleSFTPClient' (project 'SimpleSFTPClient') has compile command with input '/Users/gordonapple/Ed4U Projects/SimpleSFTPClient/SimpleSFTPClient/SimpleSFTPClient/Model/Server+CoreDataProperties.m'

        2) Target 'SimpleSFTPClient' (project 'SimpleSFTPClient') has compile command with input '/Users/gordonapple/Library/Developer/Xcode/DerivedData/SimpleSFTPClient-bknoaunyaxmtbnatoytyifidspjy/Build/Intermediates.noindex/SimpleSFTPClient.build/Debug/SimpleSFTPClient.build/DerivedSources/CoreDataGenerated/SimpleSFTPClient/Server+CoreDataProperties.m'

         

        Any idea what is going on here?

        • Re: Duplicate Errors in Linking
          szymczyk Level 3 Level 3 (100 points)

          Xcode projects that use Core Data default to automatically generating classes for Core Data entities. When you manually create the NSManagedObject subclasses or copy them from another project, you end up with duplicate classes.

           

          The solution is to either remove your NSManagedObject subclasses from the project or turn off Xcode's class generation. To turn off the class generation, open the data model inspector for the entity and choose Manual/None from the Codegen menu. For more detailed information as well as screenshots, read the article at the following URL:

           

          swiftdevjournal.com/core-data-code-generation/