Swift3 无法转换错误类型的值
我需要调试此错误的帮助Swift3 无法转换错误类型的值,swift3,Swift3,我需要调试此错误的帮助 Cannot convert value of type 'PHContentEditingInput, [AnyHashable: Any]) -> Void' to expected argument type '(PHContentEditingInput?, [AnyHashable: Any]) -> Void' 代码如下: asset?.requestContentEditingInput(with: nil, completionHandler
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
}
})
})
在
contenteditingput
的完成块中的phcontenteditingput
之后放置?
,因为它是可选类型
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
}
})
})