【发布时间】:2016-11-01 18:15:28
【问题描述】:
我有一个 updateCell 函数,我在 tableView 函数中调用它。
我正在尝试更新单元格并将 PFFile 转换为 UIImage,但我不断收到错误 Cannot convert value of type '(NSData?, NSError?) -> Void' to expected argument type 'PFDataResultBlock?'
当我从 Parse 文档中得到这个时,我感到很困惑,我无法终生找到解决方案或哪里出错了。这是我的 updateUI 函数。
func updateUI(venue: Venue) {
venueLabel.text = venue.name
let venueImageFile = venue.image
venueImageFile.getDataInBackgroundWithBlock {
(imageData: NSData?, error: NSError?) -> Void in
if error == nil {
if let imageData = imageData {
let image = UIImage(data:imageData)
}
}
}
}
这里是 Venue 类
class Venue {
private var _name: String!
private var _location: String!
private var _image: PFFile!
var name: String {
return _name
}
var location: String {
return _location
}
var image: PFFile {
return _image
}
init(name: String, location: String, image: PFFile) {
self._name = name
self._location = location
self._image = image
}
}
非常感谢任何帮助。到了现在不知道该往哪里转的地步。
【问题讨论】:
标签: swift parse-platform uiimage