'filenames are used to distinguish private declarations of the same name' error

前端 未结 8 575
没有蜡笔的小新
没有蜡笔的小新 2020-12-08 00:40

I am getting this error on generating an NSManagedObject in Xcode 8.1 in Swift.

:0: error: filename \"DemoOne+CoreDataClass.swift\" used twice: \'/Us

相关标签:
8条回答
  • 2020-12-08 00:42

    May help someone, Go to project compile source delete the extra reference if any.

    0 讨论(0)
  • 2020-12-08 00:43

    Select code data model then select the Entity change the value of 'Codegen' to Manual/None.

    It will work.

    0 讨论(0)
  • 2020-12-08 00:44

    I just restart my Macbook and that clean my build folder. And it works like a charm!

    0 讨论(0)
  • 2020-12-08 00:50

    The issue was due a second file named:"Extensions.swift" in my project.

    After deleting the duplicate "Extensions.swift" the error got resolved. Your error message might tell you which file is duplicated.

    0 讨论(0)
  • 2020-12-08 00:54

    In my case Data Model (as example: MyCoreData.xcdatamodeld) was listed twice under Editor -> Create NSManagedObject Subclass... And here was reason why it was getting this type of error.

    What I did:

    1. I did delete MyCoreData.xcdatamodeld file.
    2. Created another Data Model as example MyCD.xcdatamodeld.
    3. Checked is here duplicated Data Models in here: Editor -> Create NSManagedObject Subclass...
    4. Clean and later build for two times.
    0 讨论(0)
  • 2020-12-08 00:59

    It happened to me when I copied and renamed entity. It failed to rename the class, so do it manually.

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