我需要帮助调试此错误
Cannot convert value of type 'PHContentEditingInput, [AnyHashable: Any]) -> Void' to expected argument type '(PHContentEditingInput?, [AnyHashable: Any]) -> Void'
以下是代码:
asset?.requestContentEditingInput(with: nil, completionHandler: {(_ contentEditingInput: PHContentEditingInput, _ info: [AnyHashable: Any]) -> Void in
self.storageRef.child(filePath).putFile(imageFile, metadata: metadata, completion: {(_ metadata: FIRStorageMetadata, _ error: Error?) -> Void in
if error != nil {
return
}
})
})
答案 0 :(得分:0)
将?
放在PHContentEditingInput
的完成区contentEditingInput
之后,因为它是可选类型。
asset?.requestContentEditingInput(with: nil, completionHandler:
{(_ contentEditingInput: PHContentEditingInput?, _ info: [AnyHashable: Any]) -> Void in
self.storageRef.child(filePath).putFile(imageFile, metadata: metadata, completion: {(_ metadata: FIRStorageMetadata, _ error: Error?) -> Void in
if error != nil {
return
}
})
})