Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PFUser subclasses are never unboxed #5

Open
fatuhoku opened this issue Sep 25, 2014 · 0 comments · May be fixed by #6
Open

PFUser subclasses are never unboxed #5

fatuhoku opened this issue Sep 25, 2014 · 0 comments · May be fixed by #6

Comments

@fatuhoku
Copy link

This is due to the fact that

  • PFUser objects are subclasses of PFObject
  • unboxing logic checks for PFObject (which catches both PFObjects and PFUsers) before testing for PFUser.
   ..
    // Lastly, if this class is a PFObject or PFUser and it is registered, instantiate the appropriate ParseModel...
    else if ([object isKindOfClass:[PFObject class]]) {
        // *** PFUser FALLS IN TO THIS CASE
        NSString *unboxedClassString = (self.registeredParseModels)[[(PFObject *) object parseClassName]];
        if (unboxedClassString.length) {
            unboxedObject = [(ParseModel *) [NSClassFromString(unboxedClassString) alloc] initWithParseObject:object];
        }
    }
    else if ([object isKindOfClass:[PFUser class]]) {
        // *** CODE NEVER GETS HERE
        NSString *unboxedClassString = (self.registeredParseUsers)[[(PFUser *) object parseClassName]];
        if (unboxedClassString.length) {
            unboxedObject = [(ParseModelUser *) [NSClassFromString(unboxedClassString) alloc] initWithParseUser:object];
        }
    }

This means the latter branch will never be reached. They need to be reversed.

@fatuhoku fatuhoku changed the title PFUser subclasses are not unboxed properly. PFUser subclasses are never unboxed Sep 25, 2014
@fatuhoku fatuhoku linked a pull request Sep 25, 2014 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant