迁移到Swift 5后,我在第三方代码中遇到此错误。这是什么意思,我该如何解决?
/**
The timer's execution interval, in seconds.
*/
public let interval: Double!
/**
*Starts the timer.
* parameter now: true, if the timer should fire immediately.
*/
open func start(_ now: Bool) {
validate()
if OSAtomicCompareAndSwap32Barrier(State.paused, State.running,
&running) {
timer.scheduleRepeating(deadline: startTime(interval, now:
now), interval:
DispatchTimeInterval.nanoseconds(Int(interval.multiplied(by:
Double(NSEC_PER_SEC))))) // Swift Compiler Error here
timer.resume()
}
}
答案 0 :(得分:0)
使用间隔*替换乘以(by:
timer.scheduleRepeating(deadline: startTime(interval, now: now), interval: DispatchTimeInterval.nanoseconds(Int(interval * Double(NSEC_PER_SEC))))