Re: Core Data sync between iOS and Mac apps
On Tue, May 12, 2015, at 10:35 AM, Jens Alfke wrote: You can still handle conflicts using Dropbox, it’s just trickier. You’ll need to detect the renamed version of the file that Dropbox creates — something like “MyAppData (Jens Alfke's conflicted copy 2015-05-09).db” — then open both files and reconcile any changes, then save back to the original file and delete the conflicted copy. And somehow keep both devices from doing this at the same time, or you’re back at square one. There was a hilarious* bug in an early version of OmniPresence where clients a) eagerly resolved conflicts and b) did not back off if their attempt to resolve the conflict created another conflict. The result was that if you had two Macs running OmniPresence, and you managed to create a conflict, occasionally both machines would just start generating infinite duplicates of the conflicted document. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Core Data sync between iOS and Mac apps
will create a file package that looks like a locally stored UIManagedDocument but it doesn't have the logic for dealing with files in iCloud (my current plan is to build a subclass of BSManagedDocument with the extra logic in place). Apple's answer to me when I have asked about this in he past is that it is possible to sync Core Data documents through iCloud but you have to do all the heavy lifting (I have no idea if that will change in June, but I doubt it). As far as entitlements go you just need the document option enabled and to ensure that both apps use the same container. On the Mac the documents should show up in the normal open sheet just like they do for TextEdit and Preview documents that are in the cloud. These guides are a good starting point: Document Based App Programming Guide for Mac Document Based App Programming Guide for iOS iCloud Design Guide iCloud Programming Guide For Core Data Thanks, Mike Swan ETCP Certified Entertainment Electrician 347-451-5418 theMikeSwan.com On May 5, 2015, at 8:54 PM, cocoa-dev-requ...@lists.apple.com wrote: Message: 3 Date: Tue, 05 May 2015 17:31:23 -0400 From: davel...@mac.com To: CocoaDev cocoa-dev@lists.apple.com Subject: Core Data sync between iOS and Mac apps I'm looking into options for building an iOS and Mac app that can sync/share Core Data between them. I'm well aware of the issues with Core Data iCloud syncing in iOS 5 and 6 and that it is supposedly better so I'm willing to try it. The apps can have deployment targets of iOS 8 and greater and OS X 10.10. I don't expect they'll be ready to release before iOS 9 and 10.11 (or whatever it's called) are out. The apps will be document-based in that the user can open different data files each which should sync separately. The most detail explanation I can find of iCloud Core Data syncing is WWDC 2013 session 207 (which apparently also applies to iOS 8) and the objc.io issue: http://www.objc.io/issue-10/icloud-core-data.html I looked into Ensembles (http://www.ensembles.io) a bit last year and bought a support package. I'm also aware of BSManagedDocument (but haven't tried using it). And I've seen this http://ossh.com.au/design-and-technology/software-development/ but I didn't see any accompanying code. I'm comfortable with Objective-C, Swift, and Core Data locally, but not syncing Core Data. Is there someone where that I should look for that describes the steps in detail including setting the proper entitlements, etc. in Xcode 6? I assume now that the iOS synced data would show up in the iCloud Drive on the Mac - correct - or am I missing something that it is only for iCloud Documents, not Core Data sync? I don't quite understand how URLForUbiquityContainer comes into play on the Mac if the files now appear local on the Mac. After the user chooses File - Open would they navigate to the iCloud Drive and select the file? If so, how does the code then use URLForUbiquityContainer. Pointers to any documentation or tutorials or recommendations would be appreciated. Thanks, Dave Reed ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/alex%40webis.net This email sent to a...@webis.net -- Alex Kac - President and Founder Web Information Solutions, Inc. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Core Data sync between iOS and Mac apps
On May 12, 2015, at 6:00 AM, davel...@mac.com wrote: I’m not sure I understand your concerns about Dropbox. The app is single user so when the iOS enters the background, I can upload the data (if there’s a network connection at the moment) for modified files to Dropbox. A single-user app is less likely to encounter conflicts, but it can still happen since many users have multiple iOS devices. I frequently end up switching from iPhone to iPad, sometimes even the same app (quickly check news on my iPhone, start reading an article, go upstairs and grab the iPad so I can read the article more comfortably…) And if your app doesn’t somehow deal with this, it’s looking at potential data-loss scenarios. You can still handle conflicts using Dropbox, it’s just trickier. You’ll need to detect the renamed version of the file that Dropbox creates — something like “MyAppData (Jens Alfke's conflicted copy 2015-05-09).db” — then open both files and reconcile any changes, then save back to the original file and delete the conflicted copy. And somehow keep both devices from doing this at the same time, or you’re back at square one. —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Core Data sync between iOS and Mac apps
Thanks MIchael. That's what I was afraid of (i.e., that Apple doesn't make this straightforward). I first looked at BSManagedDocument 2-3 years ago but never got around to trying it for my original app as I kept hoping Apple would have an official solution to this problem. Also thanks to Jens Alfke for his reply about Couchbase Lite (http://www.couchbase.com/nosql-databases/couchbase-mobile). I may look into it but after skimming the site, I couldn't tell exactly what I would need (i.e., would I need to setup my own server or use a server that your company provides, etc.). I doubt my app would generate enough income to even cover the server costs. My apps are for teachers and I write them because I want to use them myself but they don't generate much money given the fairly narrow target audience and that many schools provide systems the teacher has to use for the tasks (i.e., my existing iOS apps, Attendance and Attendance2 are for taking attendance in class and generating reports, etc.). Jens, I may send you an email off-list with a few more questions (that you can ignore if you want). I may just end up using Dropbox without sync (i.e., have the user send the data to Dropbox from the iOS app) when they want to use it on the Mac and import the data from Dropbox into iOS after the data has been changed on the Mac. It's not elegant but it's better than risking data corruption via an automatic sync that isn't reliable. Perhaps with some warnings about which data is newer by looking at modification dates from the file metadata, it could be usable. The app is mainly intended to be used on iOS but I want to use the Mac for one or two features that would not work well on iOS. Dave On May 7, 2015, at 10:57 AM, Michael Swan michaels...@mac.com wrote: Dave, Unfortunately on the OS X side with iCloud, Core Data, and documents it is pretty much a pick any two situation. The iOS side can be done but there are some gotchas not really covered in the documentation. I've actually just started work on my own custom subclasses of UIManagedDocument and NSDocument (NSPersistentDocument is less than useless if you want to share with iOS). My current plan is to use Apple's code as much as possible without adding extra stores like Ensembles does. If you're interested we could talk about a collaboration to build an open sourced set of classes to handle this area. (I plan to include a file browser for iOS as well since nothing currently exists.) On iOS you set two keys in the options dictionary to tell the system where to keep the change logs and what the name should be. The name is typically a UUID and the location is generally some version of ChangeLogs at the root level of the ubiquity container. The catch is that your can't set those options in configurePersistentStoreCoordinator… and have it come out right. You have to init the document then set the persistentStoreOptions property to a dictionary with those keys in order for the file package to get the right structure. You also need to create the document locally first and then move it to the ubiquity container. On OS X NSPersistentDocument can only make flat files, not packages like UIManagedDocument (I've filed a bug about there being no counterpart to UIManagedDocument for OS X, been open for over a year now…). BSManagedDocument will create a file package that looks like a locally stored UIManagedDocument but it doesn't have the logic for dealing with files in iCloud (my current plan is to build a subclass of BSManagedDocument with the extra logic in place). Apple's answer to me when I have asked about this in he past is that it is possible to sync Core Data documents through iCloud but you have to do all the heavy lifting (I have no idea if that will change in June, but I doubt it). As far as entitlements go you just need the document option enabled and to ensure that both apps use the same container. On the Mac the documents should show up in the normal open sheet just like they do for TextEdit and Preview documents that are in the cloud. These guides are a good starting point: Document Based App Programming Guide for Mac Document Based App Programming Guide for iOS iCloud Design Guide iCloud Programming Guide For Core Data Thanks, Mike Swan ETCP Certified Entertainment Electrician 347-451-5418 theMikeSwan.com On May 5, 2015, at 8:54 PM, cocoa-dev-requ...@lists.apple.com wrote: Message: 3 Date: Tue, 05 May 2015 17:31:23 -0400 From: davel...@mac.com To: CocoaDev cocoa-dev@lists.apple.com Subject: Core Data sync between iOS and Mac apps I'm looking into options for building an iOS and Mac app that can sync/share Core Data between them. I'm well aware of the issues with Core Data iCloud syncing in iOS 5 and 6 and that it is supposedly better so I'm willing to try it. The apps can have deployment targets of iOS 8 and greater and OS X 10.10
Re: Core Data sync between iOS and Mac apps
Guide iCloud Programming Guide For Core Data Thanks, Mike Swan ETCP Certified Entertainment Electrician 347-451-5418 theMikeSwan.com On May 5, 2015, at 8:54 PM, cocoa-dev-requ...@lists.apple.com wrote: Message: 3 Date: Tue, 05 May 2015 17:31:23 -0400 From: davel...@mac.com To: CocoaDev cocoa-dev@lists.apple.com Subject: Core Data sync between iOS and Mac apps I'm looking into options for building an iOS and Mac app that can sync/share Core Data between them. I'm well aware of the issues with Core Data iCloud syncing in iOS 5 and 6 and that it is supposedly better so I'm willing to try it. The apps can have deployment targets of iOS 8 and greater and OS X 10.10. I don't expect they'll be ready to release before iOS 9 and 10.11 (or whatever it's called) are out. The apps will be document-based in that the user can open different data files each which should sync separately. The most detail explanation I can find of iCloud Core Data syncing is WWDC 2013 session 207 (which apparently also applies to iOS 8) and the objc.io issue: http://www.objc.io/issue-10/icloud-core-data.html I looked into Ensembles (http://www.ensembles.io) a bit last year and bought a support package. I'm also aware of BSManagedDocument (but haven't tried using it). And I've seen this http://ossh.com.au/design-and-technology/software-development/ but I didn't see any accompanying code. I'm comfortable with Objective-C, Swift, and Core Data locally, but not syncing Core Data. Is there someone where that I should look for that describes the steps in detail including setting the proper entitlements, etc. in Xcode 6? I assume now that the iOS synced data would show up in the iCloud Drive on the Mac - correct - or am I missing something that it is only for iCloud Documents, not Core Data sync? I don't quite understand how URLForUbiquityContainer comes into play on the Mac if the files now appear local on the Mac. After the user chooses File - Open would they navigate to the iCloud Drive and select the file? If so, how does the code then use URLForUbiquityContainer. Pointers to any documentation or tutorials or recommendations would be appreciated. Thanks, Dave Reed ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/alex%40webis.net This email sent to a...@webis.net -- *Alex Kac - **President and Founder* *Web Information Solutions, Inc.* ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Core Data sync between iOS and Mac apps
On May 10, 2015, at 6:16 AM, davel...@mac.com wrote: Also thanks to Jens Alfke for his reply about Couchbase Lite (http://www.couchbase.com/nosql-databases/couchbase-mobile). I may look into it but after skimming the site, I couldn't tell exactly what I would need (i.e., would I need to setup my own server or use a server that your company provides, etc.). Couchbase doesn’t (yet?) offer a hosted server, although it’s pretty easy to set one up in a generic hosting environment like AWS or Heroku. Also, the replication protocol is compatible with that used by Cloudant’s hosting service. One thing I’d like would be a lightweight turnkey replication server you could easily run on a Mac or PC. I think that would be appealing for many users, partly because they’d have control over where their data is stored. We’ve done this as a proof-of-concept (it even runs on a Raspberry Pi!) but so far it has too many moving parts for it to be something an end user can easily set up. —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Core Data sync between iOS and Mac apps
On Thu, 7 May 2015 10:57:05 -0400, Michael Swan said: On OS X NSPersistentDocument can only make flat files, not packages like UIManagedDocument (I've filed a bug about there being no counterpart to UIManagedDocument for OS X, been open for over a year now…). Only a year? Mine's been open for 3 years now. Duped to rdar://9447453 which is still open too. Cheers, -- Sean McBride, B. Eng s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Core Data sync between iOS and Mac apps
Dave, Unfortunately on the OS X side with iCloud, Core Data, and documents it is pretty much a pick any two situation. The iOS side can be done but there are some gotchas not really covered in the documentation. I've actually just started work on my own custom subclasses of UIManagedDocument and NSDocument (NSPersistentDocument is less than useless if you want to share with iOS). My current plan is to use Apple's code as much as possible without adding extra stores like Ensembles does. If you're interested we could talk about a collaboration to build an open sourced set of classes to handle this area. (I plan to include a file browser for iOS as well since nothing currently exists.) On iOS you set two keys in the options dictionary to tell the system where to keep the change logs and what the name should be. The name is typically a UUID and the location is generally some version of ChangeLogs at the root level of the ubiquity container. The catch is that your can't set those options in configurePersistentStoreCoordinator… and have it come out right. You have to init the document then set the persistentStoreOptions property to a dictionary with those keys in order for the file package to get the right structure. You also need to create the document locally first and then move it to the ubiquity container. On OS X NSPersistentDocument can only make flat files, not packages like UIManagedDocument (I've filed a bug about there being no counterpart to UIManagedDocument for OS X, been open for over a year now…). BSManagedDocument will create a file package that looks like a locally stored UIManagedDocument but it doesn't have the logic for dealing with files in iCloud (my current plan is to build a subclass of BSManagedDocument with the extra logic in place). Apple's answer to me when I have asked about this in he past is that it is possible to sync Core Data documents through iCloud but you have to do all the heavy lifting (I have no idea if that will change in June, but I doubt it). As far as entitlements go you just need the document option enabled and to ensure that both apps use the same container. On the Mac the documents should show up in the normal open sheet just like they do for TextEdit and Preview documents that are in the cloud. These guides are a good starting point: Document Based App Programming Guide for Mac Document Based App Programming Guide for iOS iCloud Design Guide iCloud Programming Guide For Core Data Thanks, Mike Swan ETCP Certified Entertainment Electrician 347-451-5418 theMikeSwan.com On May 5, 2015, at 8:54 PM, cocoa-dev-requ...@lists.apple.com wrote: Message: 3 Date: Tue, 05 May 2015 17:31:23 -0400 From: davel...@mac.com To: CocoaDev cocoa-dev@lists.apple.com Subject: Core Data sync between iOS and Mac apps Message-ID: 7feb2ad4-ecec-4562-ae17-1cc1e1b73...@mac.com Content-Type: text/plain; charset=us-ascii I'm looking into options for building an iOS and Mac app that can sync/share Core Data between them. I'm well aware of the issues with Core Data iCloud syncing in iOS 5 and 6 and that it is supposedly better so I'm willing to try it. The apps can have deployment targets of iOS 8 and greater and OS X 10.10. I don't expect they'll be ready to release before iOS 9 and 10.11 (or whatever it's called) are out. The apps will be document-based in that the user can open different data files each which should sync separately. The most detail explanation I can find of iCloud Core Data syncing is WWDC 2013 session 207 (which apparently also applies to iOS 8) and the objc.io issue: http://www.objc.io/issue-10/icloud-core-data.html I looked into Ensembles (http://www.ensembles.io) a bit last year and bought a support package. I'm also aware of BSManagedDocument (but haven't tried using it). And I've seen this http://ossh.com.au/design-and-technology/software-development/ but I didn't see any accompanying code. I'm comfortable with Objective-C, Swift, and Core Data locally, but not syncing Core Data. Is there someone where that I should look for that describes the steps in detail including setting the proper entitlements, etc. in Xcode 6? I assume now that the iOS synced data would show up in the iCloud Drive on the Mac - correct - or am I missing something that it is only for iCloud Documents, not Core Data sync? I don't quite understand how URLForUbiquityContainer comes into play on the Mac if the files now appear local on the Mac. After the user chooses File - Open would they navigate to the iCloud Drive and select the file? If so, how does the code then use URLForUbiquityContainer. Pointers to any documentation or tutorials or recommendations would be appreciated. Thanks, Dave Reed ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators
Re: Core Data sync between iOS and Mac apps
On May 5, 2015, at 2:31 PM, davel...@mac.com wrote: I'm looking into options for building an iOS and Mac app that can sync/share Core Data between them. I'm well aware of the issues with Core Data iCloud syncing in iOS 5 and 6 and that it is supposedly better so I'm willing to try it. I wouldn't recommend it. The sync mechanism for Core Data is IMHO a terrible kludge, and you have zero visibility into the server-side storage nor any ability to diagnose server-side problems. I still see user complaints in reviews of apps that use iCloud sync (Ulysses is one recent example.) On the other hand, I'm biased because I work on a competing sync solution, Couchbase Lite*. It's designed from the ground up to do sync, you can run your own server, it supports multi-user sharing, and it's all open source. It has its own Cocoa API, but you can also use it as a back-end for Core Data. Another solution to look into is Parse**. It's apparently pretty fast and reliable, although as a hosted service you don't have control over the servers (and you have to trust Facebook to play nice with your data.) Dropbox has a data-sync API, but they just announced that they're deprecating it and phasing it out. —Jens * http://www.couchbase.com/nosql-databases/couchbase-mobile http://www.couchbase.com/nosql-databases/couchbase-mobile ** http://parse.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Core Data sync between iOS and Mac apps
I'm looking into options for building an iOS and Mac app that can sync/share Core Data between them. I'm well aware of the issues with Core Data iCloud syncing in iOS 5 and 6 and that it is supposedly better so I'm willing to try it. The apps can have deployment targets of iOS 8 and greater and OS X 10.10. I don't expect they'll be ready to release before iOS 9 and 10.11 (or whatever it's called) are out. The apps will be document-based in that the user can open different data files each which should sync separately. The most detail explanation I can find of iCloud Core Data syncing is WWDC 2013 session 207 (which apparently also applies to iOS 8) and the objc.io issue: http://www.objc.io/issue-10/icloud-core-data.html I looked into Ensembles (http://www.ensembles.io) a bit last year and bought a support package. I'm also aware of BSManagedDocument (but haven't tried using it). And I've seen this http://ossh.com.au/design-and-technology/software-development/ but I didn't see any accompanying code. I'm comfortable with Objective-C, Swift, and Core Data locally, but not syncing Core Data. Is there someone where that I should look for that describes the steps in detail including setting the proper entitlements, etc. in Xcode 6? I assume now that the iOS synced data would show up in the iCloud Drive on the Mac - correct - or am I missing something that it is only for iCloud Documents, not Core Data sync? I don't quite understand how URLForUbiquityContainer comes into play on the Mac if the files now appear local on the Mac. After the user chooses File - Open would they navigate to the iCloud Drive and select the file? If so, how does the code then use URLForUbiquityContainer. Pointers to any documentation or tutorials or recommendations would be appreciated. Thanks, Dave Reed ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com