The PFImageView
, with its .file
property and its corresponding -loadInBackground
method, is really useful. I'm having trouble figuring out how to "go the other way", i.e. get the PFFile
reference from a new image:
RA_MyAccount.h (extract)
@property (weak, nonatomic) IBOutlet PFImageView *profilePic;
-(IBAction)saveButtonTapped:(id)sender;
RA_MyAccount.m (extract)
-(void)setLocalImageToPFImageView:(UIImage *)localImage
{
self.profilePic.image = localImage
}
-(IBAction)saveButtonTapped:(id)sender
{
PFUser *cUser = [PFUser currentUser];
// Get the PFFile reference for the new image
PFFile *file;
file = ??? ??? ??? ???
// Set
cUser[PF_USER_PIC] = file;
[cUser saveInBackgroundWithBlock:
^(BOOL succeeded, NSError *error){
[self performSegueWithIdentifier:@"unwindtotabviewsegue" sender:self];
}];
}
I've indicated with ??? ??? ??? ???
where I'm having problems.