1

I have a large image stored as a CKAsset, as part of a record that also contains a date and other details which may potentially change. The image and other details are all stored locally in my app.

If I change the date (say) and try to resubmit the record to CloudKit (by creating a new record, setting up its data fields, and using CKModifyRecordsOperation) it appears the CKAsset data is re-uploaded and subsequently downloaded to all devices.

If I try not setting the CKAsset information in the record, I get a "failed to modify some records" error message.

How can I avoid unnecessary transfers of the image (I am not worried about the other data being sent unnecessarily, as it is small)?

Should I be storing the CKAsset to a seperate linked record, so that I only have to download the image when it changes?

Peter Johnson
  • 3,764
  • 1
  • 23
  • 27
  • I don't necessarily know best practice, but I am in a similar situation and I did set up a separate record for the image. As a separate record, I set it up with a background-download `CKSubscription` so that client apps can be notified to download the image only when it changes. – Anthony C Nov 15 '16 at 19:32
  • 1
    I ended up storing images separately too, only took an hour or two to change over, but now I'm in control of everything. – Peter Johnson Nov 15 '16 at 23:55

1 Answers1

2

To avoid extra unnecessary transfers of large chunks of data, you can store the image in a separate record.

This way, small data items (that may be updated frequently) can be synced more often without having the image adversely affecting your data caps.

Anthony C
  • 1,990
  • 3
  • 23
  • 40