GM release of Xcode 6 compile

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

    If you are using some API which should be used in early iOS version, you may get build failure. For example: If you are using UI_USER_INTERFACE_IDIOM() instead of UIDevice.currentDevice().userInterfaceIdiom to identify the device type, you will get this build error with no hint.

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

    change

    func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell!  
    

    TO

    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
    

    and do the same to others like this

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

    By following @maxvel's suggestion, I got to know that max() and min() functions failed to compile in the release mode. I replaced it with my own functions like below.

    //Swift compiler seems to failing to compile default min and max functions in release 
    //mode hence writing my own
    //
    func maximum<T: Comparable> (one: T, other: T) -> T {
        if one > other {
            return one
        }
        else {
            return other
        }
    }
    
    func minimum<T: Comparable> (one: T, other: T) -> T {
        if one < other {
            return one
        }
        else {
            return other
        }
    }
    
    0 讨论(0)
提交回复
热议问题