GM release of Xcode 6 compile

前端 未结 21 2254
难免孤独
难免孤独 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:15

    In my case Xcode gave the error because of the following line :

    if UI_USER_INTERFACE_IDIOM() ==  UIUserInterfaceIdiom.Phone {
    
    
    }else {
    
    }
    

    And to fix the error I've defined this :

    enum UIUserInterfaceIdiom : Int {
        case Unspecified
        case Phone // iPhone and iPod touch style UI
        case Pad // iPad style UI
    }
    

    And then i used it like :

     if UIDevice.currentDevice().userInterfaceIdiom == .Phone {
    
    }
    

    Good luck !

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

    I was also getting this error. I ran the the command in Terminal as suggested by @Maxwell and found out the error was in my GameViewController.swift file. A little digging around and found that it didn't like some auto-generated code or the code conflicted with a setting in Xcode somewhere

    override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {
    
        if UIDevice.currentDevice().userInterfaceIdiom == .Phone {
            return .AllButUpsideDown
        } else {
            return .All
        }
    }
    

    As soon as I removed this block the error went away.

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

    In my case i changed 3 places:

    Target > Build Settings > Swift Compiler >

    • Optimization Level.
      • Debug: None [-Onone]
      • Distribution: Fastest [-O]
      • Release: Fastest [-O]

    When i changed just Debug, i have errors like "Source Kit crashed...." This combination of parameters, works very good for me!

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

    I think it occured for many reasons, what I have encountered is this situation,hope it could help you.

    dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0) ){ [weak self] in
    
            // ...
            dispatch_async(dispatch_get_main_queue()) { [weak self] in
    
                // ...
                return
    
            }
        }
    

    In the upper code,just delete "[weak self]" called capture list will remove the compiler error. It works for me.

    dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0) ){ [weak self] in
    
            // ...
            dispatch_async(dispatch_get_main_queue()) {
    
                // ...
                return
    
            }
        }
    

    xCode version is 6.1.1

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

    Encounter this error when compiling this Swift 2.0 syntax in Xcode 6.4:

    print(string, appendNewline: true);

    Back to Xcode 7 and the error is gone.

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

    In my case this error was caused by the incorrect (UTF8) .swift file encoding; Solved by copy-pasting the file's contents into a new file.

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