HealthKit export crashing Shortcuts App

For quite a while I was able to export HealthKit samples using Federico Viticci’s Export Blood Pressure Meter shortcut from the MacStories Shortcuts Archive. I kept it simple and made several copies where I only changed the HealthKit category.

Unfortunately one/some of these shortcuts (for example the one for caffeine) now crash the Shortcuts App during their execution.

What could be wrong here? Maybe I exceed a limit?

I have been tracking caffeine daily since October 2016 and in general there should be less than 10 entries per day (that’s not all coffee; also green tea and hot chocolate).

Does this shortcut still work for others with larger datasets?

I have been using this shortcut because Apple’s native HealthKit export always crashes after generation, before it is shared to anything… (I have an Apple Watch since Series 0, so there’s a lot of data in HealthKit)

I just downloaded that and changed it to work on caffeine rather than blood pressure. I’ve been tacking my caffeine since almost the start of the year and it exported just fine for me on my iPhone (only an old 8+).

Have you tried seeing what happens if you set the start date to “is in the last 7 days”? If that works with the last 12 months not working, then that would point to it being a data volume issue, and is what I referred to in the other thread when you noted the issue. Shrink the data set and see if it continues to fail.

Seems like a good next step.

Will experiment with that.

  • Export last 12 months: crash
  • Export last 11 months: works
  • Export between last 12 and last 11 months: works (so no weird value there?)

Looks like at most 11 months can now be exported at once, while I could export much more at once in the past… :cry:

Looks very much like the data volume is crossing a volume threshold related to the resources available on your device for Shortcuts to run with. Most likely, but not definitely the amount of memory available. That seems to be the usual reason for data crashes where volume is involved.

The logical approach therefore comes back to batching the data export each time, or the quicker approach of just a running delta and extracting only the additions that have been made since the last run, then appending them to whatever your external data store is.

Also, are you really sure you could export much more in the past? Time isn’t actually what determines the volume. It would be the number of records. For example if your daily caffeine consumption went up in terms of the number of caffeinated products you took, then that would increase the volume.