ios - Delete object from user class in Parse.com -


i'm trying delete image connected current user imageone column in parse.com. user class.

pfquery *query = [pfuser query]; [query selectkeys:@[@"imageone"]]; [query getobjectinbackgroundwithid:[[pfuser currentuser] objectid] block:^(pfobject *object, nserror *error) {     if (!error) {         [object deleteinbackground];     } }]; 

my code doesn't work , console logs error "user cannot deleted unless have been authenticated via login or signup".

how can fix this?

seems problem comes fact object (image) comes user class, right?

why doing query users , doing delete current user, that's worst possible way structure query (and fail).

if current user isn't in first 100 returned above code never find match.

this sort of query should instead done using getobjectinbackgroundwithid:block:, in case of current user have object, this:

[[pfuser currentuser] deleteinbackground]; 

if instead want delete information in column, use following:

pfuser *currentuser = [pfuser currentuser]; [currentuser removeobjectforkey:@"imageone"]; [currentuser saveinbackground]; 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -