【问题标题】:Swift compiling error [duplicate]Swift编译错误[重复]
【发布时间】:2018-06-13 07:26:13
【问题描述】:

我和我的团队在 Xcode 9.4 中编译 Objective C 项目时遇到问题。有人知道发生了什么吗?

<unknown>:0: error: filename "Message+CoreDataClass.swift" used twice: '/Users/josepmmirabent/houtel-ios-2016/Houtel2/DerivedData/Jumbotours/Build/Intermediates.noindex/Jumbotours.build/Debug-iphonesimulator/Jumbotours.build/DerivedSources/CoreDataGenerated/Model/Message+CoreDataClass.swift' and '/Users/josepmmirabent/houtel-ios-2016/Houtel2/DerivedData/Jumbotours/Build/Intermediates.noindex/Jumbotours.build/Debug-iphonesimulator/Jumbotours.build/DerivedSources/CoreDataGenerated/Model/Message+CoreDataClass.swift'
<unknown>:0: note: filenames are used to distinguish private declarations with the same name
<unknown>:0: error: filename "Message+CoreDataProperties.swift" used twice: '/Users/josepmmirabent/houtel-ios-2016/Houtel2/DerivedData/Jumbotours/Build/Intermediates.noindex/Jumbotours.build/Debug-iphonesimulator/Jumbotours.build/DerivedSources/CoreDataGenerated/Model/Message+CoreDataProperties.swift' and '/Users/josepmmirabent/houtel-ios-2016/Houtel2/DerivedData/Jumbotours/Build/Intermediates.noindex/Jumbotours.build/Debug-iphonesimulator/Jumbotours.build/DerivedSources/CoreDataGenerated/Model/Message+CoreDataProperties.swift'
<unknown>:0: note: filenames are used to distinguish private declarations with the same name
<unknown>:0: error: filename "Model+CoreDataModel.swift" used twice: '/Users/josepmmirabent/houtel-ios-2016/Houtel2/DerivedData/Jumbotours/Build/Intermediates.noindex/Jumbotours.build/Debug-iphonesimulator/Jumbotours.build/DerivedSources/CoreDataGenerated/Model/Model+CoreDataModel.swift' and '/Users/josepmmirabent/houtel-ios-2016/Houtel2/DerivedData/Jumbotours/Build/Intermediates.noindex/Jumbotours.build/Debug-iphonesimulator/Jumbotours.build/DerivedSources/CoreDataGenerated/Model/Model+CoreDataModel.swift'
<unknown>:0: note: filenames are used to distinguish private declarations with the same name
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1

谢谢!

【问题讨论】:

    标签: ios objective-c swift xcode


    【解决方案1】:

    进入您的project settings &gt; select your main app target &gt; Build phases &gt; Compile Sources 并删除该列表中引用编译错误中列出的文件的重复条目。看起来有些文件被列出了两次编译,这会导致这个问题。

    这通常是 xcode 项目文件中的问题,由于手动解决项目文件中的 git 冲突而发生此问题。

    如果这不能解决您的问题,请确保项目中没有同名文件。

    【讨论】:

    • Message+CoreDataClass.swift 不在列表中,因为它是一个 Objective C 项目。 @Scriptable
    • 您需要参考上面重复的建议链接。该问题是由自动生成的核心数据模型引起的
    猜你喜欢
    • 2014-08-28
    • 2014-09-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多