0

I'm getting an error, (see below), when I'm trying to pas a PFObject to a detailVC and press a cell in the tableView. As I see it I'm doing it right.

I'm loading the objects in the timeLineData Array and using a storyboard NavigationController. Also I use 2 querys to get the firstname and lastname in a UISearchBar.

+[PFObject parseClassName]: unrecognized selector sent to class

I've used a exception breakpoint to look for the error, it gives me this:

TongerenApp`-[PFObject(Private) init] at PFObject.m:156:
0x150535:  pushl  %ebp
0x150536:  movl   %esp, %ebp
0x150538:  pushl  %ebx
0x150539:  pushl  %edi
0x15053a:  pushl  %esi
0x15053b:  subl   $0x2c, %esp
0x15053e:  calll  0x150543                  ; -[PFObject(Private) init] + 14 at PFObject.m:156
0x150543:  popl   %ebx
0x150544:  movl   0x8(%ebp), %eax
0x150547:  movl   %eax, -0x18(%ebp)
0x15054a:  movl   0xd4291(%ebx), %eax
0x150550:  movl   %eax, -0x14(%ebp)
0x150553:  movl   0xd258d(%ebx), %eax
0x150559:  movl   %eax, -0x1c(%ebp)
0x15055c:  movl   %eax, 0x4(%esp)
0x150560:  leal   -0x18(%ebp), %eax
0x150563:  movl   %eax, (%esp)
0x150566:  calll  0x1be5fe                  ; symbol stub for: objc_msgSendSuper2
0x15056b:  movl   %eax, %esi
0x15056d:  testl  %esi, %esi
0x15056f:  je     0x150840                  ; -[PFObject(Private) init] + 779 at PFObject.m:186
0x150575:  movl   0xd44cd(%ebx), %edi
0x15057b:  cmpl   $0x0, (%esi,%edi)
0x15057f:  jne    0x1505ef                  ; -[PFObject(Private) init] + 186 at PFObject.m:165
0x150581:  movl   0xd41e1(%ebx), %eax
0x150587:  movl   %eax, -0x24(%ebp)
0x15058a:  movl   0xd28d9(%ebx), %eax
0x150590:  movl   %eax, -0x20(%ebp)
0x150593:  movl   %eax, 0x4(%esp)
0x150597:  movl   %esi, (%esp)
0x15059a:  calll  0x1be5f8                  ; symbol stub for: objc_msgSend
0x15059f:  movl   0xd2e6d(%ebx), %ecx
0x1505a5:  movl   %eax, 0x8(%esp)
0x1505a9:  movl   %ecx, 0x4(%esp)
0x1505ad:  movl   -0x24(%ebp), %eax
0x1505b0:  movl   %eax, (%esp)
0x1505b3:  calll  0x1be5f8                  ; symbol stub for: objc_msgSend
0x1505b8:  movl   -0x20(%ebp), %eax
0x1505bb:  movl   %eax, 0x4(%esp)
0x1505bf:  movl   %esi, (%esp)
0x1505c2:  calll  0x1be5f8                  ; symbol stub for: objc_msgSend
0x1505c7:  movl   0xd3c91(%ebx), %ecx
0x1505cd:  movl   %ecx, 0x4(%esp)
0x1505d1:  movl   %eax, (%esp)
0x1505d4:  calll  0x1be5f8                  ; symbol stub for: objc_msgSend
----> 0x1505d9:  movl   %eax, (%esp)              <----------------------------- It gets stuck here.
0x1505dc:  calll  0x1be628                  ; symbol stub for: objc_retainAutoreleasedReturnValue
0x1505e1:  movl   (%esi,%edi), %ecx
0x1505e4:  movl   %eax, (%esi,%edi)
0x1505e7:  movl   %ecx, (%esp)
0x1505ea:  calll  0x1be610                  ; symbol stub for: objc_release
0x1505ef:  movl   0xd41d5(%ebx), %eax
0x1505f5:  movl   0xd2875(%ebx), %ecx
0x1505fb:  movl   %ecx, -0x20(%ebp)
0x1505fe:  movl   %ecx, 0x4(%esp)
0x150602:  movl   %eax, (%esp)
0x150605:  calll  0x1be5f8                  ; symbol stub for: objc_msgSend
0x15060a:  movl   -0x1c(%ebp), %ecx
0x15060d:  movl   %ecx, 0x4(%esp)
0x150611:  movl   %ecx, %edi
0x150613:  movl   %eax, (%esp)
0x150616:  calll  0x1be5f8                  ; symbol stub for: objc_msgSend
0x15061b:  movl   0xd44d5(%ebx), %ecx
0x150621:  movl   (%esi,%ecx), %edx
0x150624:  movl   %eax, (%esi,%ecx)
0x150627:  movl   %edx, (%esp)
0x15062a:  calll  0x1be610                  ; symbol stub for: objc_release
0x15062f:  movl   0xd3fe1(%ebx), %eax
0x150635:  movl   0xd3651(%ebx), %ecx
0x15063b:  movl   %ecx, -0x24(%ebp)
0x15063e:  movl   %ecx, 0x4(%esp)
0x150642:  movl   %eax, (%esp)
0x150645:  calll  0x1be5f8                  ; symbol stub for: objc_msgSend
0x15064a:  movl   %eax, (%esp)
0x15064d:  calll  0x1be628                  ; symbol stub for: objc_retainAutoreleasedReturnValue
0x150652:  movl   0xd44d9(%ebx), %ecx
0x150658:  movl   (%esi,%ecx), %edx
0x15065b:  movl   %eax, (%esi,%ecx)
0x15065e:  movl   %edx, (%esp)
0x150661:  calll  0x1be610                  ; symbol stub for: objc_release
0x150666:  movl   0xd3ff9(%ebx), %eax
0x15066c:  movl   %eax, -0x28(%ebp)
0x15066f:  movl   0xd407d(%ebx), %eax
0x150675:  movl   -0x20(%ebp), %ecx
0x150678:  movl   %ecx, 0x4(%esp)
0x15067c:  movl   %eax, (%esp)
0x15067f:  calll  0x1be5f8                  ; symbol stub for: objc_msgSend
0x150684:  movl   %edi, 0x4(%esp)
0x150688:  movl   %eax, (%esp)
0x15068b:  calll  0x1be5f8                  ; symbol stub for: objc_msgSend
0x150690:  movl   %eax, %edi
0x150692:  movl   0xd2e71(%ebx), %eax
0x150698:  movl   %edi, 0x8(%esp)
0x15069c:  movl   %eax, 0x4(%esp)
0x1506a0:  movl   -0x28(%ebp), %eax
0x1506a3:  movl   %eax, (%esp)
0x1506a6:  calll  0x1be5f8                  ; symbol stub for: objc_msgSend
0x1506ab:  movl   %eax, (%esp)
0x1506ae:  calll  0x1be628                  ; symbol stub for: objc_retainAutoreleasedReturnValue
0x1506b3:  movl   0xd44dd(%ebx), %ecx
0x1506b9:  movl   (%esi,%ecx), %edx
0x1506bc:  movl   %eax, (%esi,%ecx)
0x1506bf:  movl   %edx, (%esp)
0x1506c2:  calll  0x1be610                  ; symbol stub for: objc_release
0x1506c7:  movl   %edi, (%esp)
0x1506ca:  calll  0x1be610                  ; symbol stub for: objc_release
0x1506cf:  movl   0xd3fe1(%ebx), %eax
0x1506d5:  movl   -0x24(%ebp), %ecx
0x1506d8:  movl   %ecx, 0x4(%esp)
0x1506dc:  movl   %eax, (%esp)
0x1506df:  calll  0x1be5f8                  ; symbol stub for: objc_msgSend
0x1506e4:  movl   %eax, (%esp)
0x1506e7:  calll  0x1be628                  ; symbol stub for: objc_retainAutoreleasedReturnValue
0x1506ec:  movl   0xd44e1(%ebx), %ecx
0x1506f2:  movl   (%esi,%ecx), %edx
0x1506f5:  movl   %eax, (%esi,%ecx)
0x1506f8:  movl   %edx, (%esp)
0x1506fb:  calll  0x1be610                  ; symbol stub for: objc_release
0x150700:  movl   0xd3fe1(%ebx), %eax
0x150706:  movl   -0x20(%ebp), %edi
0x150709:  movl   %edi, 0x4(%esp)
0x15070d:  movl   %eax, (%esp)
0x150710:  calll  0x1be5f8                  ; symbol stub for: objc_msgSend
0x150715:  movl   -0x1c(%ebp), %ecx
0x150718:  movl   %ecx, 0x4(%esp)
0x15071c:  movl   %eax, (%esp)
0x15071f:  calll  0x1be5f8                  ; symbol stub for: objc_msgSend
0x150724:  movl   0xd44e5(%ebx), %ecx
0x15072a:  movl   (%esi,%ecx), %edx
0x15072d:  movl   %eax, (%esi,%ecx)
0x150730:  movl   %edx, (%esp)
0x150733:  calll  0x1be610                  ; symbol stub for: objc_release
0x150738:  movl   0xd3fe1(%ebx), %eax
0x15073e:  movl   %edi, 0x4(%esp)
0x150742:  movl   %eax, (%esp)
0x150745:  calll  0x1be5f8                  ; symbol stub for: objc_msgSend
0x15074a:  movl   -0x1c(%ebp), %edi
0x15074d:  movl   %edi, 0x4(%esp)
0x150751:  movl   %eax, (%esp)
0x150754:  calll  0x1be5f8                  ; symbol stub for: objc_msgSend
0x150759:  movl   0xd44e9(%ebx), %ecx
0x15075f:  movl   (%esi,%ecx), %edx
0x150762:  movl   %eax, (%esi,%ecx)
0x150765:  movl   %edx, (%esp)
0x150768:  calll  0x1be610                  ; symbol stub for: objc_release
0x15076d:  movl   0xd44ed(%ebx), %eax
0x150773:  movl   (%esi,%eax), %ecx
0x150776:  movl   $0x0, (%esi,%eax)
0x15077d:  movl   %ecx, (%esp)
0x150780:  calll  0x1be610                  ; symbol stub for: objc_release
0x150785:  movl   0xd44f1(%ebx), %eax
0x15078b:  movl   (%esi,%eax), %ecx
0x15078e:  movl   $0x0, (%esi,%eax)
0x150795:  movl   %ecx, (%esp)
0x150798:  calll  0x1be610                  ; symbol stub for: objc_release
0x15079d:  movl   0xd44f5(%ebx), %eax
0x1507a3:  movl   (%esi,%eax), %ecx
0x1507a6:  movl   $0x0, (%esi,%eax)
0x1507ad:  movl   %ecx, (%esp)
0x1507b0:  calll  0x1be610                  ; symbol stub for: objc_release
0x1507b5:  movl   0xd4125(%ebx), %eax
0x1507bb:  movl   -0x20(%ebp), %ecx
0x1507be:  movl   %ecx, 0x4(%esp)
0x1507c2:  movl   %eax, (%esp)
0x1507c5:  calll  0x1be5f8                  ; symbol stub for: objc_msgSend
0x1507ca:  movl   %edi, 0x4(%esp)
0x1507ce:  movl   %eax, (%esp)
0x1507d1:  calll  0x1be5f8                  ; symbol stub for: objc_msgSend
0x1507d6:  movl   %eax, %edi
0x1507d8:  movl   0xd2e75(%ebx), %eax
0x1507de:  movl   %edi, 0x8(%esp)
0x1507e2:  movl   %eax, 0x4(%esp)
0x1507e6:  movl   %esi, (%esp)
0x1507e9:  calll  0x1be5f8                  ; symbol stub for: objc_msgSend
0x1507ee:  movl   %edi, (%esp)
0x1507f1:  calll  0x1be610                  ; symbol stub for: objc_release
0x1507f6:  movl   0xd44d1(%ebx), %ecx
0x1507fc:  movl   0xd44f9(%ebx), %eax
0x150802:  cmpb   $0x0, (%esi,%ecx)
0x150806:  je     0x150818                  ; -[PFObject(Private) init] + 739 at PFObject.m:176
0x150808:  movb   $0x0, (%esi,%eax)
0x15080c:  movl   0xd44fd(%ebx), %eax
0x150812:  movb   $0x0, (%esi,%eax)
0x150816:  jmp    0x150838                  ; -[PFObject(Private) init] + 771 at PFObject.m:183
0x150818:  movb   $0x1, (%esi,%eax)
0x15081c:  movl   0xd44fd(%ebx), %eax
0x150822:  movb   $0x1, (%esi,%eax)
0x150826:  movl   0xd2e79(%ebx), %eax
0x15082c:  movl   %eax, 0x4(%esp)
0x150830:  movl   %esi, (%esp)
0x150833:  calll  0x1be5f8                  ; symbol stub for: objc_msgSend
0x150838:  movl   %esi, (%esp)
0x15083b:  calll  0x1be616                  ; symbol stub for: objc_retain
0x150840:  movl   %esi, (%esp)
0x150843:  calll  0x1be610                  ; symbol stub for: objc_release
0x150848:  movl   %esi, %eax
0x15084a:  addl   $0x2c, %esp
0x15084d:  popl   %esi
0x15084e:  popl   %edi
0x15084f:  popl   %ebx
0x150850:  popl   %ebp
0x150851:  retl   

What could be the problem?

TableView

    override func tableView(tableView: UITableView?, cellForRowAtIndexPath indexPath: NSIndexPath?) -> UITableViewCell {
    let cell = tableView!.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath!) as UITableViewCell

    var persoon:PFObject = self.timeLineData.objectAtIndex(indexPath!.row) as PFObject

    let voornaam = persoon.objectForKey("voornaam") as String
    let achternaam = persoon.objectForKey("achternaam") as String

    //De Volledige persoonsnaam
    cell.imageView.image = UIImage(named: "dummy")
    cell.textLabel.font = UIFont(name: "Avenir Nex", size: 12)
    cell.textLabel.text = "\(voornaam) \(achternaam)"

    return cell
}

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
    if segue.identifier == "persoonSegue"{
        if let indexPath = self.tableView.indexPathForSelectedRow(){
            let persoonVC = segue.destinationViewController as DetailVC
            persoonVC.persoonData = timeLineData.objectAtIndex(indexPath.row) as PFObject
        }
    }
}

func loadData(name:String){
    timeLineData.removeAllObjects()

    var firstName = PFQuery(className: "Newfamilie")
    firstName.whereKey("voornaam", containsString: name)

    var lastName = PFQuery(className: "Newfamilie")
    lastName.whereKey("achternaam", containsString: name)

    var query = PFQuery.orQueryWithSubqueries([firstName, lastName])
    query.orderByAscending("achternaam")
    query.limit = 200
    query.findObjectsInBackgroundWithBlock {
        (objects: [AnyObject]!, error: NSError!) -> Void in
        if error == nil {
            for object in objects{
                let naam:PFObject = object as PFObject
                self.timeLineData.addObject(naam)
            }

            self.tableView.reloadData()
            self.refreshTimeLineControl.endRefreshing()

            println("\(self.timeLineData.count)")
        }
    }
}

DetailVC

class DetailVC: UIViewController {

@IBOutlet var voornaam: UILabel! = UILabel()
@IBOutlet var achternaam: UILabel! = UILabel()
@IBOutlet var dateOfBirth: UILabel! = UILabel()

var persoonData:PFObject = PFObject()

override func viewDidLoad() {
    super.viewDidLoad()

    let voornaam = persoonData.objectForKey("voornaam") as String
    let achternaam = persoonData.objectForKey("achternaam") as String
    let datum = persoonData.objectForKey("geboortedatum") as String

    self.voornaam.text = voornaam
    self.achternaam.text = achternaam
    self.dateOfBirth.text = datum
}
SwingerDinger
  • 276
  • 1
  • 7
  • 21
  • 3
    The error indicates you are sending parseClassName to the PFObject class. It's an instance method. Search your code for parseClassName. The error might be obvious when you see that code (if not, post it here). – danh Jan 13 '15 at 20:00
  • possible duplicate of [How can I debug 'unrecognized selector sent to instance' error](http://stackoverflow.com/questions/25853947/how-can-i-debug-unrecognized-selector-sent-to-instance-error) – Hot Licks Jan 13 '15 at 21:18
  • Thanks for the quick reply. I just don't understand what you mean with `sending parseClassName to PFObject class` I'm still a beginner with Parse. How should I look for parseClassName? I will update my `loadData` func. – SwingerDinger Jan 13 '15 at 21:22
  • 1
    Has nothing really to do with Parse -- it's a fundamental concept of Objective-C. "Sending" a method to an object (as is done with `[someObject someMethodName]`) is essentially "calling" the method. You called a method that didn't exist (for that object class). – Hot Licks Jan 13 '15 at 21:28
  • Thanks for the help guys. I've set an exception breakpoint to find out where the error came from. I've no clue what this mean, think it has something to with initialising the PFObject. See updated code above. – SwingerDinger Jan 14 '15 at 08:44
  • Found the issue. I've init my persoondata the wrong way! had to use this `var persoonData:PFObject!` in DetailVC – SwingerDinger Jan 14 '15 at 11:09

1 Answers1

3

To solve this erros, you should implement these 2 methods in your subclass like this in .m file

+ (void)load
{
    [self registerSubclass];
}

+(NSString *)parseClassName
{
    return @"YOUR CLASS NAME HERE";
}

and then declare them in .h file like this

+(NSString *)parseClassName;
+(vendor *)createVendorWithObject:(PFObject *)object;
Bhumi Goklani
  • 603
  • 1
  • 8
  • 18