pfuser with pointer not getting data back

I have subclassed PFuser and registered it. it works great.

In my database in the User table i made a pointer to another table that has some more information.

  • Xcode shows old, deleted xib files
  • Linker errors when trying to install new Google Analytics 3.0 Beta
  • What is the difference between .dylib and .a lib in ios?
  • NSPredicate omits special characters like á â á in filterContentForSearchText method
  • How to add a delay to a loop?
  • Choose custom sound for local notifications
  • the app keeps crashing with this error:

    2014-06-08 15:14:59.550 App[2333:60b] *** Terminating app due to uncaught exception 
    reason: 'Key "place" has no data.  Call fetchIfNeeded  
    before getting its value.'

    While checking the debugger i can see it made the connection to another table but all fields are empty.

    I think i need to put something like this: [query includeKey:@"company"];
    for the pointer but I don’t do a query for the User class…

    do I need to override it somewhere ?

    this is my custom user class:

    -h file

    #import "Company.h"
    @interface PFCustomUser : PFUser<PFSubclassing>
    @property (nonatomic, retain) NSString *name;
    @property (nonatomic, retain) UIImage *userPhoto;
    @property (nonatomic, retain) Company *company;
    + (PFCustomUser *)currentUser;

    -m file

    #import "PFCustomUser.h"
    @implementation PFCustomUser
    @dynamic name,userPhoto,company;
    + (PFCustomUser *)currentUser {
    return (PFCustomUser *)[PFUser currentUser];

    In the appdelegate i do this

      [PFCustomUser registerSubclass];

    So technacly i would do this in a controller

    PFCustomUser *currentUser = [PFCustomUser currentUser];

    company is nill so place is nill. hence the error..
    In the debugger you can see it sees the objectId of company and the classname but the rest is nill

    Solutions Collect From Internet About “pfuser with pointer not getting data back”

    you have to add a setter & getter for each pointer or relation you have..

    .h file

    @property (retain) PFRelation *likes;

    .m file

    @synthesize likes = _likes;
    - (void) setLikes:(PFRelation *)likes{
        _likes = likes;
    - (PFRelation *) likes{
        if(_likes== nil) {
            _likes = [self relationforKey:@"likes"];
        return _likes;

    sample code:

    PFPlace *place = [PFPlace object]; = @"Taiwan";
    [person save];
    [place save];
    [place.likes addObject:person]
    [place save];