在 Swift 3 中我收到以下错误(这在 Swift 2 中没有发生):
No * candidates produce the expected result type FloatingPointRoundingRule
我不知道我需要做什么来修复它。
我正在尝试将纬度小数转换为度/分/秒
extension CLLocationDegrees {
mutating func toLatitudeSeconds() -> String {
var seconds = Int(round(self * 3600)) //error here
// etc ...
}
}
最佳答案
舍入函数被更改为在实例上调用而不是全局函数。您基本上是在尝试执行 self.round(self*3600)
这不起作用,因为 round
函数不接受任何参数或类型为 的参数FloatingPointRoundingRule
.
你可能想要:
var seconds = Int((self*3600).rounded())
关于ios - 没有 * 候选人产生预期的结果类型 FloatingPointRoundingRule,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39621668/