How can I do a core data sync across devices?

warement

Active member
Jun 3, 2015
25
0
0
Visit site
Core data sync across devices.

I am looking for a way to sync my core data using cloud kit across devices. Using Swift language
I Have read many books but i found nowhere something helpful.
Can someone give me a demo project with a simple core data syncing with icloud in swift.
 
Last edited by a moderator:

kch50428

Well-known member
Oct 22, 2010
21,025
305
0
Visit site
Re: Core data sync across devices.

If you're in Apple's developer program, they have extensive resources there that likely will steer you in he right direction.
 

warement

Active member
Jun 3, 2015
25
0
0
Visit site
Re: Core data sync across devices.

I am but the resources are still in objective c.
isn't anyone here who knows how to do it?
 

Scatabrain

Well-known member
Nov 15, 2010
1,728
1
0
Visit site
Re: Core data sync across devices.

I am but the resources are still in objective c.
isn't anyone here who knows how to do it?

A couple of things come to mind:
- At WWDC 2014, the slides showing CloudKit were all in swift. These sessions are all online and are a great intro to it.
- many of the guides are in ObjC but it is not difficult to translate into swift IF
- you also read the API reference for functions you are using. These are very good. They show the differences for both languages and the prototypes for both in all cases.
- use youtube for a first look on how to use swift with CloudKit. Then read the API.
- get comfortable with the code complete in xcode. It gives you the syntax in Swift for you just by typing the the func name.
- use stack overflow to get code examples when you are stuck
- there is no core data to cloudkit hook up. It is designed as 2 systems with different purposes. You are meant to write your own interface between them where you see fit.

Start with youtube.
Read the APIs.
Search stack overflow when stuck or have an error you can't figure out.

Hope that helps.
 

Scatabrain

Well-known member
Nov 15, 2010
1,728
1
0
Visit site
Re: Core data sync across devices.

A couple of things come to mind:
- At WWDC 2014, the slides showing CloudKit were all in swift. These sessions are all online and are a great intro to it.
- many of the guides are in ObjC but it is not difficult to translate into swift IF
- you also read the API reference for functions you are using. These are very good. They show the differences for both languages and the prototypes for both in all cases.
- use youtube for a first look on how to use swift with CloudKit. Then read the API.
- get comfortable with the code complete in xcode. It gives you the syntax in Swift for you just by typing the the func name.
- use stack overflow to get code examples when you are stuck
- there is no core data to cloudkit hook up. It is designed as 2 systems with different purposes. You are meant to write your own interface between them where you see fit.

Start with youtube.
Read the APIs.
Search stack overflow when stuck or have an error you can't figure out.

Hope that helps.

I use cloudkit to store:
- data you want the user to have if device is repaced
- and from multiple devices

Use core data for:
- settings specific only to one device
- needs to be available for offline use

I don't bother trying to replicate one to the other. I use each where it makes sense. It seems as if you are trying to replicate core data to CloudKit. I personally wouldn't do that directly. I would decide where each makes sense.
 

warement

Active member
Jun 3, 2015
25
0
0
Visit site
Re: Core data sync across devices.

I just want what i have on one phone to be available to my other phones.
i looked tutorials but i didnt found somethin for that only key value storage which is not what i want.
i just asked for a simple demo project that it would sync my app data to all my devices but be also aivalable offline.
It was the base idea that thing of icloud the data you have on one device be available to other devices too, but i cant find a simple tutorial to do that thing.
 

Scatabrain

Well-known member
Nov 15, 2010
1,728
1
0
Visit site
Re: Core data sync across devices.

I just want what i have on one phone to be available to my other phones.
i looked tutorials but i didnt found somethin for that only key value storage which is not what i want.
i just asked for a simple demo project that it would sync my app data to all my devices but be also aivalable offline.
It was the base idea that thing of icloud the data you have on one device be available to other devices too, but i cant find a simple tutorial to do that thing.

Core Data isn't meant to be shared storage. CloudKit isn't meant to sync Core Data. I am sure someone has done what you need. However, it is against the intended use for each. So finding examples may be difficult.

I for one love that CloudKit is not designed as a sync for core data. If you spend a bit of time with CloudKit you'll adapt your way of looking at it with the benefit of being able to do so much more.
 

warement

Active member
Jun 3, 2015
25
0
0
Visit site
Re: Core data sync across devices.

in apple developers program it says exactly
"The CloudKit framework provides interfaces for moving data between your app and your iCloud containers. You use CloudKit to take your app’s existing data and store it in the cloud so that the user can access it on multiple devices." THats what i want. to take my existing data store it in a container and sync with other devices. where am i wrong?
 

Scatabrain

Well-known member
Nov 15, 2010
1,728
1
0
Visit site
Re: Core data sync across devices.

in apple developers program it says exactly
"The CloudKit framework provides interfaces for moving data between your app and your iCloud containers. You use CloudKit to take your app?s existing data and store it in the cloud so that the user can access it on multiple devices." THats what i want. to take my existing data store it in a container and sync with other devices. where am i wrong?

I believe you are thinking you can take a core data setup and hooking up cloudkit to it without writing much code. Check out this tutorial:

http://youtu.be/XsLG9O6elrM
 

Trending Posts

Members online

Forum statistics

Threads
261,100
Messages
1,769,570
Members
441,289
Latest member
jeremy1230