Xcode 7 beta中的Int函数出错

时间:2015-09-21 10:25:27

标签: swift

我在测试Xcode 7 beta中的代码时遇到此错误,两个星号之间的错误

类ViewController:UIViewController {

@IBOutlet weak var agee: UITextField!
@IBOutlet weak var labelAge: UILabel!
@IBAction func findAge(sender: AnyObject) {


    *var enteredAge = agee!.text.toInt()*

    if enteredAge != nil {

        var catYears = enteredAge! * 7

        labelAge.text = "Your cat is \(catYears) in cat years"

    } else {

        labelAge.text = "Please enter a number in the box"

    }


}

1 个答案:

答案 0 :(得分:-1)

input(bedrooms="2",bathrooms="2",area="1000") were specified with different   types from the fit

here is my program

input <- function(bedrooms,bathrooms,area)
{
delhi <- read.delim("delhi.tsv", na.strings = "") 
delhi$lnprice <- log(delhi$price)
heddel <- lm(lnprice ~ bedrooms+ area+ bathrooms,data=delhi)
valuepred = predict (heddel,data.frame(bedrooms=bedrooms,area=area,bathrooms=bathrooms),na.rm = TRUE)
final_prediction = exp(valuepred)
final_prediction
}

只需将上述代码粘贴到您的项目中即可。

不要忘记在助理编辑器中再次连接@IBOutlets和@IBAction [ctrl + drag]。否则你会陷入信号问题(SIGABRT) 希望它有所帮助!