TICoreDataSync connecting to web server backend?

623 views Asked by At

I have been looking into alternatives to iCloud for core data sync, and one promising option is TICoreDataSync (the code can be found here). Are there any examples of modifying this to work on one's own web server, as opposed to uploading the sync files to Dropbox? What is the best way to set up TICoreDataSync?

3

There are 3 answers

0
joseph.hainline On

Have you looked into AFIncrementalStore? This Heroku introduction video talks about how easy it is to set up for an iOS app, and the hosting is free for data access and storage below production levels. Might be something worth investigating.

0
Chris Wagner On

You should check out the Remote File Hierarchy page which describes what is expected. It appears to expect a "dumb" file system where it just needs read/write access to the locations specified. This is further proved by the fact that it works with Dropbox, which only stores binary files. This type of service could be implemented in many different ways, which are not dependent on TICoreDataSync other than the defined hierarchy. You would just need a server that allows standard read/write access to the paths defined. The important question to ask is how do I point TICoreDataSync to a specific endpoint? And the answer to that seems to be by initializing a TICDSFileManagerBasedApplicationSyncManager and setting the applicationContainingDirectoryLocation property. One thing that is nebulous from the documentation here is that it does not state if this has to be a URL to a local directory. Theoretically it is an NSURL and could be set to an HTTP URL assuming that the HTTP server handles the I/O methods properly.

This is where I would start with storing information on your own server. Based on your tags for the question it looks like you are building an iOS app, and unfortunately their documentation only talks about using the DropboxSDK with iOS apps and the corresponding TICDSDropboxSDKBasedApplicationSyncManager class. If you are building a Mac app, the server components could be transparant to your app. You could write to a local directory that is mounted from a server, whether it be WebDav, SMB, SSH, etc... and use the TICDSFileManagerBasedApplicationSyncManager class.

With all that said, you may be interested in some other ways to do this. If you are interesting in a homegrown solution you could take a look at these tutorials I have written.

How To Synchronize Core Data with a Web Service – Part 1 How To Synchronize Core Data with a Web Service – Part 2

There is a lot of work to be done in order to make the application in the tutorial production worthy, but it could be insightful.

Another option is AFIncrementalStore, which provides seamless communication between CoreData and your web service backend.

In any case, syncing data like this a pretty big undertaking so be prepared to spend a lot of time on development in order to get it right!

0
Michael Fey On

Chris is correct in that TICoreDataSync just expects a plain hierarchical file system that you can access. While we don't have any other examples of using TICDS over another service (other than the iCloud feature branch) you would want to start by taking a look at subclassing TICDSApplicationSyncManager, TICDSDocumentSyncManager, and the NSOperations located in the Generic Operations group. You can read a little more about this in the updated documentation on the project wiki: https://github.com/nothirst/TICoreDataSync/wiki/Extending-the-Framework

More specifically, let's say you wanted to sync over an Amazon S3 instance. You would create TICDSAmazonS3ApplicationSyncManager and TICDSAmazonS3DocumentSyncManager classes. Then, when registering your sync managers you would use those specific subclasses. The important thing to remember is that these service-specific subclasses only need to implement the communication layer of framework, all the syncing logic is handled in the super classes. Further more, the communication points are well defined.

We recently released version 1.0.2 of the framework along with updated documentation, example apps, and tutorials on the project wiki. Check it out and if you run into any snags open an issue on the project's Issues page