I want to sync via iCloud in a Core Data app. Besides some string attributes in Core Data I also want to sync images. I did a lot of research and it seems there are two approaches to achieve this. The opinions really vary so I am confused which one is the better solution?
Approach A:
Store images in Core Data as Binary Data.
Pros:
Everything is synced with Core Data sync at the same time in one sync solution.
No extra code, which is a big plus for me since I am using Ensembles Core Data Sync Framework which is working really good.
Cons:
- People say you should not sync larger data with Core Data. But what is "Allow External Storage" for ? - I read that checking that option could lead to data loss when migrate the Core Data model. But I thought that s what it is for ? For syncing larger data... !? Should I check this or not ? Opinions vary on that...
Approach B:
Store images local in Document Directory and store the url to it in Core Data.
Pros:
- Avoid Approach A´s cons.
Cons:
Two sync solutions needed working parallel. Core Data sync and UIDocument sync for the images. - Will this work really synchron? Could it be that Core Data is already synced while UIDocument sync has failed or is slower or whatever?
Much more code. Very complex, very complicated.