I am using Parse for my application. I have a custom Request class that I installed in Parse and in my local project. In the Request object , I have a User object . The User object is subclassed from PFUser . When a user makes a request, he is sent to the server and sent to the appropriate users to accept or reject them. Sending a request works fine; everything is stored correctly in Parse. The problem is this:
After sending the request, I log out of the current user and register with another user account that should receive the request just sent. When I log in, I have a method:
+ (void)getIncomingRequestsWithCompletion: (void(^)(NSMutableArray *incomingPendingRequestsArray, NSMutableArray *incomingAcceptedRequestsArray)) complete {
PFQuery *query = [PFQuery queryWithClassName:@"Request"];
[query whereKey:@"club" equalTo:[User currentUser] [@"club"]];
[query findObjectsInBackgroundWithBlock:^(NSArray *incomingRequestsArray, NSError *error) {
NSMutableArray *incomingPendingRequestsArray = [NSMutableArray new];
NSMutableArray *incomingAcceptedRequestsArray = [NSMutableArray new];
for (int i = 0; i < incomingRequestsArray.count; i++) {
if ([[incomingRequestsArray objectAtIndex:i]acceptedHostUser]) {
[incomingAcceptedRequestsArray addObject:[incomingRequestsArray objectAtIndex:i]];
}
else if (![[[incomingRequestsArray objectAtIndex:i]decliningUsers]containsObject:[User currentUser]]) {
[incomingPendingRequestsArray addObject:[incomingRequestsArray objectAtIndex:i]];
}
}
complete (incomingPendingRequestsArray, incomingAcceptedRequestsArray);
NSLog(@"%@",error.description);
}];
}
After running this method, I get all incoming requests for the current user. This method returns queries just fine. The problem is that I am killing the application. If I kill the application, the above method will be launched when the user restarts the application. The method will return the same number of requests,
however, all properties of the User object will be absent except for objectId and several other stock properties on PFUser .
Here is the object printed before the application was killed:
<Request: 0x7fbe20bf5090, objectId: gEnwjj6ZIN, localId: (null)> {
club = "<Club: 0x7fbe20b74180, objectId: cApBkG9ZFY>";
message = "";
requestingUser = "<PFUser: 0x7fbe2043c640, objectId: LIzd2KvDwa>";
}
<PFUser: 0x7fbe2043c640, objectId: LIzd2KvDwa, localId: (null)> {
club = "<Club: 0x7fbe2088f5f0, objectId: KUa4N7fTgc>";
email = "spedroza@usc.edu";
firstName = Sergio;
handicap = 10;
headline = "Web Developer at University of Southern California";
lastName = Pedroza;
linkedInID = oOoiyTge7O;
location = "Greater Los Angeles Area";
phoneNumber = 5629224083;
profileImageFile = "<PFFile: 0x7fbe208cb900>";
username = "spedroza@usc.edu";
}
Here it is:
<Request: 0x7fe3f3d4cd50, objectId: gEnwjj6ZIN, localId: (null)> {
club = "<Club: 0x7fe3f3d287e0, objectId: cApBkG9ZFY>";
message = "";
requestingUser = "<PFUser: 0x7fe3f3d38b50, objectId: LIzd2KvDwa>";
}
<PFUser: 0x7fe3f3d38b50, objectId: LIzd2KvDwa, localId: (null)> {
}
. Club, , . , . !