2015-05-01 7 views
5

Mój kod:Xcode 6.3 SDK 1.7.1 PFTableViewCell Parse Error "ma niezgodnego typu"

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 

}

otrzymuje następujący błąd

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

Szukałem całą kompatybilność błędy (usuwanie!). Kolejny post miał podobny problem:

Parse SDK 1.7.1 not working in Xcode 6.3

Ale tylko ich liczba 3 błędzie. Wszystkie inne problemy w tym poście zostały rozwiązane, ale ten błąd nadal występuje. Jakieś rozwiązania lub zalecenia dotyczące tego, gdzie szukać?

+0

Mam ten sam problem. Czy kiedykolwiek to rozgryzłeś? –

+0

Analiza 1.7.2 jest dostępna, ale nie rozwiązuje tego problemu. –

Odpowiedz

4

Wymyśliłem to. Użyj następującego override funkcję:

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

Różnica jest dokonującej PFObject i PFTableViewCell składniki ewentualne.

+0

Dzięki Clifton! Co znalazłem również działa: zastąpić func tableView (tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> PFTableViewCell { jeśli pozwalają obiekty = obiekty jak? [PFObject] { dla obiektu w obiektach {... – Rob

Powiązane problemy