我正在尝试将一个函数作为参数传递,但它会抛出“Unit cannot be invoked as function”的错误提示。提前感谢您的帮助。
uploadImageToParse(imageFile, saveCall1())
uploadImageToParse(imageFile, saveCall2())
uploadImageToParse(imageFile, saveCall3())
private fun uploadImageToParse(file: ParseFile?, saveCall: Unit) {
saveCall()//Throws an error saying 'Unit cannot be invoked as function'
}
{saveCall()}
可以写成::saveCall
。 - marstran