Exporting your data from HealthKit

I made a discovery this morning: as a regular user, not a ninja iOS app developer, you can export all your data from HealthKit! I have to confess I hadn't specifically looked into it, but I had assumed that all my data was kinda locked up in my phone (and in encrypted backups on iTunes) and that the only way to get access to it was to give particular apps specific permissions to access the data. In short, I assumed I was going to have to fire up Xcode one day and write a wee app to trawl my data and extract it[^1].

Continue reading… Save to Instapaper

Square
Cover image for Exporting your data from HealthKit.

I made a discovery this morning: as a regular user, not a ninja iOS app developer, you can export all your data from HealthKit! I have to confess I hadn’t specifically looked into it, but I had assumed that all my data was kinda locked up in my phone (and in encrypted backups on iTunes) and that the only way to get access to it was to give particular apps specific permissions to access the data. In short, I assumed I was going to have to fire up Xcode one day and write a wee app to trawl my data and extract it1.

But it turns out that’s not the case. While I was mucking around with the Health app this morning, I happened across a familiar looking share button:

A screenshot showing the familiar iOS share button inside HealthKit

Open up the Health app on your iPhone, then tap the Health Data tab at the bottom, tap List at the top, then tap on All (the first item in that list). It gives you a list of categories you have logged some health data against. And, sure enough, on the top right hand corner, there’s that share button. I was curious, so I tapped it to see what happens. It popped up with a wee message, elucidating slightly:

A screenshot showing the export dialog

Curiouser and curiouser. Naturally, I ventured forth and tapped Export. It pops up a second dialog letting you know that it’s preparing your data for export. This takes quite a few moments. In fact, it took long enough that my iPhone auto-locked the first time I tried it this afternoon. When I unlocked the phone again, I was faced with a message saying that the export had failed. In retrospect, I suspect that this is because access to your health data is prohibited when the phone is locked, so Apple’s own export process was kicked out when auto-lock kicked in.

On the second attempt, I’ve been gently caressing the phone’s screen every few moments to make sure it doesn’t lock again. It’s taken a good 2-3 minutes to prepare. But when it’s done, you’re presented with the familiar share sheet, including an option to save it to Dropbox:

A screenshot showing the iOS 9 share sheet

That’s the option I’ve chosen. It then proceeds to upload a file called export.zip to my Dropbox, which takes another couple of minutes. I have this sense that I’ve got a lot of data in there! In fact, I’m now wishing I’d just Airdropped it to that dapper looking gentleman on the iMac…

Stay tuned for the next instalment, when I go spelunking into export.zip to see what it contains!


  1. And given how many of these projects I have to do in my ‘spare’ time, the chances of ever getting around to it were pretty slim! 

About this article

Article metadata
Attribute Value
Author
Publisher
Also appears on Medium
First published
Last updated
Category Quantified Self
Tags
License Creative Commons Licence