Reputation: 37
I want to delete / overwrite a photo to Parse for a given user. Will you help me? Because I wrote the code that I always return error 102
PFQuery *query = [PFQuery queryWithClassName:@"User"];
[query whereKey:@"User" equalTo:[PFUser currentUser]];
[query includeKey:@"Foto"];
[query whereKeyExists:@"Dev.png"]; //Change this condition to fetch the row.
[query getFirstObjectInBackgroundWithBlock:^(PFObject *object1, NSError *error)
{
if (!error) {
NSLog(@"Successfully retrieved: %@", object1);
//This might work as I searched for this deleting image but there is no method to do so.
//So a way would be is to get that object and then setting nil value in it's place.
//Else if u want to delete the entire row then u could simply type, [object deleteInBackground]
object1[@"Foto"] = [NSNull null];
}
else
{
NSLog(@"Error: %@", [error localizedDescription]);
}
}];
This is my table:
Upvotes: 0
Views: 267
Reputation: 17186
Change this line:
[query whereKey:@"User" equalTo:[PFUser currentUser]];
With below line:
[query whereKey:@"username" equalTo:[PFUser currentUser]];
Upvotes: 1