Example #1
0
        private async Task AddSamples(IEnumerable <HKObject> objects)
        {
            if (_suppressed)
            {
                return;
            }

            var samples = objects.ToArray();

            if (samples.Length == 0)
            {
                return;
            }

            var result = await _healthStore.SaveObjectsAsync(samples);

            if (!result.Item1)
            {
                throw new InvalidOperationException($"Can't sync health kit: {result.Item2.LocalizedDescription}");
            }
        }