Export Data from CloudKit

I am interacting with the cloudkit dashboard and looking at data collected by my app.

How can I export all the data from the dashboard (data-> csv or json) so that I can do some analytics on it?

Thanks!

Upvotes: 8

Views: 1840

Answers (2)

zeeshan
zeeshan

Reputation: 5053

Here is how I export my iCloud data on my Mac using this wonderful DB browser called DB Browser for SQLite.

I run my app on Simulator. The app syncs with iCloud and downloads both public and private databases. Once the sync is complete I have all the data on my simulator. The data is essentially in SQlite format stored in a file which I locate using command in my app:

print("\(NSHomeDirectory())/Library/Application Support/")

and the result is something like:

/Users/zeeshan/Library/Developer/CoreSimulator/Devices/34A4ADC6-1B67-4339-B67F-C4B6DDA46B07/data/Containers/Data/Application/E8F9486B-B40B-47D0-84C1-1043241E68EA/Library/Application Support/

And here .sqlite file is saved. In my case I have two files, private.sqlie and public.sqlite which is how I have named them in my code.

Now I open these files in DB Browser for SQLite. And then rest is simple, just export the opened file as you would do for any SQlite file.

Attached are the screenshots.

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

Upvotes: 0

Sascha
Sascha

Reputation: 67

I don't think Apple will ever provide an export feature. The system is capable to collecting more than 40 events per second. This could very quickly be massive amount of data. Instead there is a possibility to query the system via an API, so you can build an external website to query your results and possibly export your data from there.

Upvotes: 2

Related Questions