If you weren't trying to update the PFUser object, you could simply iterate through them one by one, and remove the object for the column.
PFQuery *query = [PFQuery queryWithClassName:"AnyNonUserOrInstallationClass"];
[query whereKey:@"objectId" containedIn:usersArray];
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
if (!error) {
for (PFObject *object in objects) {
[object removeObjectForKey:@"image"];
}
// And then you can save all the updated objects via a single call to Parse.com
[PFObject saveAllInBackground:objects block:^(BOOL success, NSError *error) {
// Check success/error.
}];
}
}];
Because you're updating the PFUser, you need to use the master key. You can do this by creating a cloud code function, and saving the user objects in there.
Cloud code
var _ = require('underscore');
Parse.Cloud.define("removeUserImages", function(request, response) {
var query = new Parse.Query(Parse.User);
// Add your criteria for selection, usersArray needs to be passed into the function
query.containedIn("objectId", request.params["usersArray"]);
query.find().then( function(users) {
_.each(users, function(user) {
user.unset("image");
});
Parse.Cloud.useMasterKey();
return Parse.Object.saveAll(users);
}).then(function(result) {
response.success("Success");
}, function(error) {
response.error("Couldn't remove images from users");
});
});
Objective-C to call cloud function
// oid1, oid2 should be the objectIds of the users you want to remove images from
[PFCloud callFunctionInBackground:@"removeUserImages" withParameters:@{@"usersArray" : @["oid1", "oid2"]} block:^(id result, NSError *error){
if (!error) {
}
}];
Note: None of the above is tested. I've just typed it in here.