视图文件中出现错误的行是:
displays = brain.evaluateWithErrorReport(using:dictionaryForVaribles)
我收到的错误是:
mov r/m16,Sreg
编译器说修复是添加: 如! (结果:Double,isPending:Bool,sequence:String,errorMessage:String?)
所以这条线现在看起来像: displays = brain.evaluateWithErrorReport(using:dictionaryForVaribles)as! (结果:Double,isPending:Bool,sequence:String,errorMessage:String?)
如果没有as,为什么它不会工作! ?
这个程序有两个文件,它们是iTunes上CS193P的第2部分。
查看文件:
mov Sreg,Sreg
模型文件:
/Users/Tom/Developer/Stsnford-IOS 10 Course/Calculator_IOS10/Calculator_IOS10/ViewController.swift:166:26: Cannot assign value of type '(result: Double?, isPending: Bool, description: String, errorDescription: String?)' (aka '(result: Optional<Double>, isPending: Bool, description: String, errorDescription: Optional<String>)') to type '(result: Double, isPending: Bool, sequence: String, errorMessage: String?)' (aka '(result: Double, isPending: Bool, sequence: String, errorMessage: Optional<String>)')
答案 0 :(得分:0)
一个简单的错字。在evaluateWithErrorReport中,您的返回值是否为“Double?”显示变量的类型包括“Double”而不是“Double?”。