ios - How do I delete a row from a Parse object? -
i have class on parse.com called "hospital", has few rows on it. want query rows in object, , selectively delete of them.
i figure need cycle through object, gathering objectids, , @ row associated each id figure out ones should deleted. can't find how anywhere. i've tried this:
pfquery *query = [pfquery querywithclassname:@"hospital"];
but returns object 0 objects inside it, when there row in parse.com database.
once part working, , objectids, seems can delete row following:
pfobject *testobject = [pfobject objectwithoutdatawithclassname:@"hospital" objectid:@"nmz8glj3re"]; [testobject deleteinbackgroundwithblock:^(bool succeeded, nserror *error) { if (succeeded){ nslog(@"booooom"); // function refresh data } else { nslog(@"delete errir"); } }];
pfquery *query = [pfquery querywithclassname:@"hospital"]; [query findobjectsinbackgroundwithblock:^(nsarray *hospitals, nserror *error) { if (!error) { (pfobject *hospital in hospitals) { if ([hospital.objectid isequaltostring:@"nmz8glj3re"]) { [hospital deleteinbackgroundwithblock:^(bool succeeded, nserror *error) { if (succeeded){ nslog(@"booooom"); // function refresh data } else { nslog(@"delete errir"); } }]; } } } else { nslog(@"%@",error); } }];
Comments
Post a Comment