I have the following code which is loading a list of users from Parse into an array named users:
PFUser *currentUser = [PFUser currentUser];
NSString *currentUserUni = currentUser[@"university"];
//Parse Query
//-------------------------------------------
PFQuery *query = [PFQuery queryWithClassName:@"_User"];
[query whereKey:@"university" equalTo:currentUserUni];
[query setLimit:50];
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
[users removeAllObjects];
[users addObjectsFromArray:objects];
}];
But if I try to call users outside of that closing bracket at the end, it is nil. Does anyone know 1)what would be causing this? and 2)How can I get the values into an array that can be accessed outside of that closing bracket?