Xcode-beta 8. Can't create core data

前端 未结 9 1324
伪装坚强ぢ
伪装坚强ぢ 2020-12-13 09:06

I have been trying to add core data. And every time I got the same error:

error: filename \"EntityName +CoreDataClass.swift\" used twice: \'/Users/userName/         


        
9条回答
  •  一生所求
    2020-12-13 09:44

    Xcode 8 includes automatic NSManagedObject class generation when the model file uses the Xcode 8 file format. If you create your own subclass files, you're creating duplicates. The second file in the error message, in DerivedSources, is the one that Xcode created automatically.

    If the automatically generated files do what you need, just stop creating your own and you'll be OK.

    If you want to create your own subclasses instead, you can either

    • Set the "tools version" for the model file to be Xcode 7.3 or earlier to disable all code generation (this doesn't seem to change anything meaningful about the actual file contents), or
    • Disable automatic generation for each entity individually by setting the "Codegen" setting to "Manual/None" for the entity.

提交回复
热议问题