Swift compiler segmentation fault when building

后端 未结 30 2270
南旧
南旧 2020-11-29 03:59

Adding a (convenient) computed height property to UIView in my UIViewExtension.swift file is causing the Swift compiler to segfault...

相关标签:
30条回答
  • 2020-11-29 04:39

    In my case I had declared a struct inside a func. Moving the struct to class level solved the issue.

    Now that I write this I remember having had issues with struct inside funcs before. It was something else than the segmentation fault (which seems to become notorious with the Swift 1.2 beta). OMG Apple, what are you doing there?

    0 讨论(0)
  • 2020-11-29 04:40

    In my case, a misplaced colon during string interpolation broke mine (XCode 6.1.1).

    Example:

    println("\(value1:value2)") 
    

    when I meant to do:

    println("\(value1) : \(value2)")
    
    0 讨论(0)
  • 2020-11-29 04:40

    I got this error with the following method signature in a custom UITableViewController.

    func filterContentForSearchText(searchText: String)
    

    changing to:

    func filterContentForSearchText(searchText: String!)
    

    fixed the problem.

    0 讨论(0)
  • 2020-11-29 04:41

    Swift 3.0 (Xcode 8.1) exhibits this issue when a protocol declares an optional variable, and an implementer implements that variable as a lazy initialised one.

    Bug is reported here: https://bugs.swift.org/browse/SR-1825

    0 讨论(0)
  • 2020-11-29 04:42

    I had the same problem in a swift project. The issue was a function that should have returned an object, but didn't have a return in it. This sort of error used to be signaled while editing with Obj-C. It seems like t isn't the case in Swift.

    0 讨论(0)
  • 2020-11-29 04:45

    I had this error too, and I fixed it like this:

    Check your project and find out which files are used twice and remove one, or delete and re-add them all.

    Errors in my Xcode:

    :0: error: filename "AttributedString.swift" used twice: '/Users/.../CNJOB/CNJOB/AttributedString.swift' and '/Users/.../CNJOB/CNJOB/AttributedString.swift'

    :0: note: filenames are used to distinguish private declarations with the same name

    :0: error: filename "APIClient.swift" used twice: '/Users/.../CNJOB/CNJOB/APIClient.swift' and '/Users/.../CNJOB/CNJOB/APIClient.swift'

    :0: note: filenames are used to distinguish private declarations with the same name

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

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