public Task <bool> DeleteWeightIntoHealthStore(WeightData weight) { int index = data.FindIndex(x => Math.Abs(x.Value - weight.Value) < 0.01 && weight.Date.Ticks == x.Date.Ticks); var sample = results[index]; var completionSource = new TaskCompletionSource <bool>(); HealthStore.DeleteObject(sample, (success, error) => { if (!success) { /*InvokeOnMainThread(delegate * { * new UIAlertView("HealthKit", "No puede borrar este registro, ha sido creado por otra app", null, "OK", null).Show(); * }); * Console.WriteLine("An error occured saving the weight sample {0}. " + * "In your app, try to handle this gracefully. The error was: {1}.", sample, error.LocalizedDescription); * return;*/ completionSource.SetResult(false); } else { completionSource.SetResult(true); } }); return(completionSource.Task); }