Xcode 6.0.1 Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1

后端 未结 24 2327
长情又很酷
长情又很酷 2020-11-27 13:18

I am getting this error on archive:

Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with

相关标签:
24条回答
  • 2020-11-27 14:04

    This happened to me when I used static inline function from swift file

    The function looks like this

    static inline void openURLInSafari(NSString * _Nonnull urlString) {
    [[UIApplication sharedApplication]openURL:[NSURL URLWithString:urlString]];}
    
    0 讨论(0)
  • 2020-11-27 14:05

    Deleted files reference keep in Build Phase and that's why it gives this error. Remove reference from there as well.

    Project> Target > Build Phase

    Under this section you will find your deleted files in red colour. Remove these files error will resolve.

    0 讨论(0)
  • 2020-11-27 14:05

    One possible reason that this can happen is perhaps because you have deleted a file but not removed references to it. This will mess up the pbxproj file. I would check to see if that is the case.

    0 讨论(0)
  • 2020-11-27 14:06

    I don't know if this is really an answer, but...

    I had the same issue. App worked when building/running, but archiving failed with "...swiftc failed with exit code 1", with no other helpful message at all. Luckily, when I tried to build my app with Nomad's ipa build, I got:

    The following build commands failed:
        CompileSwift normal arm64 /path/to/erroneous/TableViewController.swift
    

    So I started commenting out sections of that file and tracked the problem down to a tuple assignment.

    // MARK: - Table Data
    
    private var tableData: [(sectionName: String, item:ListItem)] = []
    
    private func refreshTableData() {
    
        // let labor = ("Labor", laborListItem)                 // DOESN'T ARCHIVE
        let labor = (sectionName: "Labor", item: laborListItem) // ARCHIVES
    
        tableData = [labor]
    
        tableView.reloadData()
    }
    

    So apparently the compiler wanted the elements in thast tuple named (as defined by the type of tableData).. but only for archiving? The Dumb thing is, I use this same pattern in other view controllers, and the compiler seems to be fine with those.

    For the record my Code Generation -> Optimization Level was set to None for debug and release.

    Hope this helps someone! It took hours to figure this out.

    0 讨论(0)
  • In my case, it was caused by duplicate files, using the same name, in my project directory. As soon as I removed them, the error was gone.

    0 讨论(0)
  • 2020-11-27 14:06

    this error comes from missing files so the compiler couldn't find the files and keep alerting. Follow these steps to rebuild your app:

    1. Look up for the red and invisible files within workspace
    2. Remove their reference
    3. Re-add files
    4. Re-compile
    0 讨论(0)
提交回复
热议问题