GM release of Xcode 6 compile

前端 未结 21 2252
难免孤独
难免孤独 2020-12-02 15:37

I just downloaded the GM release of Xcode 6 and it won\'t compile with this error:

Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault         


        
相关标签:
21条回答
  • 2020-12-02 16:26

    I have the following code showing build error in Release.

    if myValue > 5 { myValue = 5.0 }
    if myValue < 0 { myValue = 0 }
    

    Adding else between if statements fixed the issue:

    if myValue > 5 { myValue = 5.0 }
    else
    if myValue < 0 { myValue = 0 }
    

    Demo: https://github.com/exchangegroup/build-error-demo

    Xcode Version 6.1 (6A1052d). Builds alright in debug. Submitted ticket to Apple Bug Reporter.

    0 讨论(0)
  • 2020-12-02 16:27

    Go to the folder: Users/user/Library/Developer/Xcode/DerivedData

    and clear all file,

    then then clean and analyze,

    It`s work to me.

    0 讨论(0)
  • 2020-12-02 16:28

    I see many reasons. My answer is not a generic solution but just adding yet another case that provide to that error. In my case it was setting a button's title like this:

    button!.setTitleColor(.whiteColor(), forState: UIControlState.Normal)
    

    instead of this:

    button!.setTitleColor(UIColor.whiteColor(), forState: UIControlState.Normal)
    
    0 讨论(0)
  • 2020-12-02 16:29

    Just to put this out there: I get this error whenever I put [unowned self] in a block within a block, like this:

    lazy var someVar: SomeType = {
        self.successBlock = {[unowned self] in
            // ...
        }
    }()
    

    The solution is to put the [unowned self] only at the topmost-level block. It seems an unowned reference to self is handled automatically for blocks within blocks.

    Of course, I was only able to find this error by first finding out the troublesome file via @Maxwell's answer: https://stackoverflow.com/a/26848000/855680

    0 讨论(0)
  • 2020-12-02 16:33

    May be the same issue Swift compile error in XCode 6 GM

    I had the same problem, then I use git checkout old versions to find which commit cause the problem, and try to find the key problem code. My key problem code is something like this

    func afunc() {
        class AClass() {
        }
        let ac = AClass()
        //....
    }
    

    Other code could make the same problem, occur in Swift Optimization, and swift compiler doesn't tell you the exact location. This must be a bug by Apple.

    0 讨论(0)
  • 2020-12-02 16:33

    Maxwell's solution gives you the closest hint.

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