加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Xcode 6.3解析SDK 1.7.1 PFTableViewCell错误“具有不兼容的类型

发布时间:2020-12-14 19:24:52 所属栏目:百科 来源:网络整理
导读:我的代码: override func tableView(tableView: UITableView,cellForRowAtIndexPath indexPath: NSIndexPath,object: PFObject) - PFTableViewCell{ var cell = tableView.dequeueReusableCellWithIdentifier("CustomCell") as! CustomTableViewCell! if ce
我的代码:

override func tableView(tableView: UITableView,cellForRowAtIndexPath indexPath: NSIndexPath,object: PFObject) -> PFTableViewCell{

    var cell = tableView.dequeueReusableCellWithIdentifier("CustomCell") as!
        CustomTableViewCell!
    if cell == nil {
        cell = CustomTableViewCell(style: UITableViewCellStyle.Default,reuseIdentifier: "CustomCell")
    }

    // Extract values from the PFObject to display in the table cell
    if let username = object["username"] as? String {
        cell.customUser.text = username
    }
    if let title = object["Title"] as? String {
        cell.customTitle.text = title
    }

    // Display image
    var initialThumbnail = UIImage(named: "Swarm_Bee.png")

    if let thumbnail = object["imageFile"] as? PFFile {

        thumbnail.getDataInBackgroundWithBlock{
            (imageData,error) -> Void in
            if error == nil {
                let image = UIImage(data: imageData!)
                cell.customImage.image = image
            }}
    }

    return cell

}

收到以下错误

overriding method with selector 'tableView:cellForRowAtIndexPath:object:' has incompatible type '(UITableView,NSIndexPath,PFObject) -> PFTableViewCell'

我查找了所有兼容性错误(删除!).另一篇文章有??类似的问题:

Parse SDK 1.7.1 not working in Xcode 6.3

但只有他们的3号错误.该帖子中的所有其他问题都已得到解决,但此错误仍然存??在.任何解决方案或建议在哪里看?

解决方法

我想到了.使用以下覆盖功能:

override func tableView(tableView: UITableView,object: PFObject?) -> PFTableViewCell? { 
  //... 
}

不同之处在于制作PFObject和PFTableViewCell选项.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读