Guide to Examples
Guide to the Mac and iOS example applications that come with the TICoreDataSync framework
The TICoreDataSync GitHub repository includes a number of example Xcode projects.
There are two primary applications included, Notebook and ShoppingList.
By default, encryption is disabled for both example apps. To enable it, you’ll need to delete any data you’ve previously synchronized to Dropbox, then change the two encryption-related application sync manager delegate methods to specify a password instead of nil
.
The Notebook Application
The Notebook
Mac project, and iOSNotebook
/iOSNotebookDelay
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:
The iOS version looks like this:
The iOSNotebookDelay
project is currently an experimental example to test recent modifications to the framework to allow configuration and registration of an app to be delayed until necessary for a synchronization, etc, task.
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.
-
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.
-
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.
-
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"
When you build and run the iOSNotebook project for the first time, you’ll be greeted by a Dropbox login screen:
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 on Dropbox, and each additional client will download the store uploaded by the first client on subsequent launches.
The ShoppingList Application
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:
Once you’ve configured synchronization by following the wizard, you’ll be able to synchronize shopping list documents:
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.”