Guide to Example Apps - nothirst/TICoreDataSync GitHub Wiki

Guide to the Mac and iOS example applications that come with the TICoreDataSync framework

The TICoreDataSync GitHub repository includes two example Xcode projects, a Notebook application for OS X and a Notebook application for iOS.

The Notebook Application

The Notebook Mac project, and iOSNotebook iOS project represent an example non-document-based application.

Both synchronize the same data via Dropbox, the Mac via FileManager-based sync, iOS via the DropboxSDK-based sync.

The Mac interface looks like this: Notebook sample app screenshot

The iOS version looks like this: Notebook sample app screenshot

Desktop Dropbox Location for the Mac Example

The Mac Notebook example app is hard-wired to assume that you have a local desktop Dropbox located at ~/Dropbox. If you haven’t yet signed up for a Dropbox account, or installed the Dropbox application on your Mac, you’ll need to do this before running the Notebook application.

Configuring iOSNotebook Dropbox Information

In order to build the iOS application, you’ll need to provide a Dropbox Developer secret and key. If you don’t follow the steps below, you’ll receive build errors when trying to compile the project.

  1. Register as a Dropbox Developer - Start by visiting http://www.dropbox.com/developers/apps, and sign in to your Dropbox account. You may need to agree to a Developer license agreement to access the Dropbox API, if you haven’t previously done so.
  2. Register a Development Application - Click the Create an App button to add Dropbox API access for this iOSNotebook project. Specify a name and description, then press Create, and you’ll be assigned a unique secret and access key.
  3. Specify Your Key and Secret in the iOSNotebook Project - Open the iOSNotebook project in Xcode, then find the DropboxSettings.h file. Uncomment the two #defines and specify your secret and key as Objective-C strings:
#define kTICDDropboxSyncKey @"blah12345678blah"
#define kTICDDropboxSyncSecret @"1234blahblah5678"
  1. When you build and run the iOSNotebook project for the first time, you’ll be greeted by a Dropbox login screen: iOS Dropbox Login

Enter your Dropbox account details and press the Link button.

Working with Both Client Applications

It doesn’t matter whether you run the iOS client first, or the Mac client. Either will create the necessary [file hierarchy](Remote File Hierarchy) on Dropbox, and each additional client will download the store uploaded by the first client on subsequent launches.

The ShoppingList Application

Editor's Note: This application doesn't currently exist. There is an issue open to bring it back from the grave.

The ShoppingList and ShoppingListAlternate directories represent a Mac example document-based application.

Both projects are identical, and use the same source code files, except for the bundle identifier. This means you can run both applications at the same time to simulate synchronizing with a client on another machine.

There is currently no iOS version of the ShoppingList application, as there’s currently no easy and built-in Cocoa Touch way to deal with multiple documents. The DropboxSDK-based sync managers support the same multi-document capabilities as the Mac FileManager-based versions, so if you use your own document management techniques, TICoreDataSync will handle the synchronization in the same way as on the Mac desktop.

ShoppingList Interface

The ShoppingList application employs a multi-pane, animated wizard-style interface to configure synchronization at first launch: ShoppingList sync setup screen

Once you’ve configured synchronization by following the wizard, you’ll be able to synchronize shopping list documents: A ShoppingList document

Code Organization

Most of the Application-related synchronization functionality is handled by the TISLSynchronizationController class.

The Document-related synchronization functionality is handled by the MyDocument class.

This is still an in-progress example, and has been used for testing various features, so the code is not exactly “clean.”