I've been trying to figure this out via research and plowing through the docs for a few days and I can't get it / I don't understand it.
Here's what I'm trying to achieve:

I have a custom class named "ProfilePhotos" and a standard User class. I have some code that is "working" when I dump images onto the main User class in a column called "profilePicture". I need to get the image from 'imageFile' in the ProfilePhotos class.
I CAN figure out how to create images into one class (ProfilePhotos), but CAN'T figure out how to call them up while gathering data from the User to whom the image belongs ("Name" field).
The code I have that works, but has some weird bugs (images load in the wrong order, not at all, crashes) is below:
@interface CollectionViewController () <UITextViewDelegate>
@property (nonatomic, strong) NSMutableArray *imageArray;
@property (nonatomic, strong) UIImageView *imageView;
@property (nonatomic, strong) PFObject *theName;
@end
@implementation CollectionViewController
- (instancetype) init { //INIT STUFF }
-(void) viewDidLoad { //VIEWDIDLOAD STUFF }
-(void) DataCalls {
PFQuery *getPhotos = [PFUser query];
[getPhotos findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
if (!error) {
NSLog(@"Objects Are:%@", objects);
_imageArray = [[NSMutableArray alloc] initWithArray:objects];
for (PFObject* photo in objects ) {
PFFile *pictureFile = [photo objectForKey:@"profilePicture"];
_theName = [photo objectForKey:@"Name"];
[self.collectionView reloadData];
NSLog(@"Name is:%@", _theName);
[pictureFile getDataInBackgroundWithBlock:^(NSData *data, NSError *error) {
if (!error) {
NSLog(@"Fetching image..");
[_imageArray addObject:[UIImage imageWithData:data]];
NSLog(@"Size of the _imageArray : %lu", (unsigned long)[_imageArray count]);
} else {
// Log details of the failure
NSLog(@"Error: %@ ", error);
}
}];
}
}
}];
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
PhotoCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"photo" forIndexPath:indexPath];
_imageView = (UIImageView *)[cell viewWithTag:200];
PFObject *imageObject = [_imageArray objectAtIndex:indexPath.row];
PFFile *imageFile = [imageObject objectForKey:@"profilePicture"];
[imageFile getDataInBackgroundWithBlock:^(NSData *data, NSError *error) {
if (!error) {
_imageView.image = [UIImage imageWithData:data];
}
}];
PFObject *nameText = [imageObject objectForKey:@"Name"];
NSLog(@"Name in the CV:%@", nameText);
cell.userName.text= imageObject[@"Name"];
return cell;
}