当我尝试将 job?.id(一个 Int64)作为 Int 参数传递时(虽然我知道它没有那么大),swift 编译器提示这个错误,我尝试了几种方法来转换它,但没有成功:
Cannot convert value of type 'Int64?' to expected argument type 'Int'
我的代码:
Job.updateJobStatus(token: tok, jobId: job?.id, status:JobSatus.canceled) { (result, error) in
if result != nil
{
}
else if error != nil
{
}
}
最佳答案
你可以很容易地去:
let int64Value: Int64 = 123456
let intValue = NSNumber(value: int64Value).intValue
关于swift - 无法将类型 'Int64?' 的值转换为预期的参数类型 'Int',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47514183/