0

I have a PFObject class where each object has a user attached to it. I can call each object and display it in a tableview, however when I try to call the associated PFUser to each object it just crashes.

PFObject *owner = [self.objectArray objectAtIndex:indexPath.row];
NSString *ownerString = [owner objectForKey:@"user"];

cell.detailTextLabel.text = ownerString;

Is there another way I need to call the user to get the username? In the NSLog the user looks like this: user = \"<PFUser:dDeHnc33EE>\";\n

Derek Saunders
  • 401
  • 1
  • 4
  • 14
  • What's the crash? You've left out the most important part of your question. – CrimsonChris Oct 06 '14 at 16:10
  • sorry! Error I keep getting is this: `'-[PFUser isEqualToString:]: unrecognized selector sent to instance 0x7fcc71ec8b20'` @CrimsonChris – Derek Saunders Oct 06 '14 at 16:16
  • That error is saying that something tried to call the method `isEqualToString:` on an instance of `PFUser`. `PFUser` does not have that method. http://www.raywenderlich.com/10209/my-app-crashed-now-what-part-1 – CrimsonChris Oct 06 '14 at 16:19

1 Answers1

1

PFUser is not an NSString, it's a subclass of PFObject which again is a subclass of NSObject. PFUser has a property called username which returns a string. Do this:

PFUser *user = [owner objectForKey:@"user"];
NSString *username = user.username;

to get the username of the user. Check of the PFUser documentation here.

Jorn
  • 1,054
  • 9
  • 25