Dado que Apple requiere que todas las aplicaciones que permiten la creación de cuentas también permitan la eliminación de cuentas en la aplicación, estoy tratando de actualizar mi aplicación que usa Parse para seguir las pautas. Tengo una función CloudCode configurada:
Parse.Cloud.define("deleteUserWithId", function(request, response) { var userId = request.params.userId; var query = new Parse.Query(Parse.User); query.get(userId).then(function(user) { return user.destroy(); { useMasterKey: true } }).then(function() { response.success(user); }, function(error) { response.error(error); }); });Luego lo llamo desde la aplicación como:
PFUser *me = [[PFUser currentUser] fetch]; NSString *objectID = me.username; [PFCloud callFunctionInBackground:@"deleteUserWithId" withParameters:@{@"userId": objectID} block:^(NSString *success, NSError *error) { if (!error) { NSLog(@"Successful deletion"); } else { NSLog(@"%@", error.description); } }];El NSLog imprime "Eliminación exitosa", pero en mi base de datos Parse, el usuario aún aparece. En la sección Cloud Code me sale este mensaje:
UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)