ParcelKit
ParcelKit integrates Core Data with Dropbox using the Dropbox Datastore API.
Installation
ParcelKit can be added to a project using CocoaPods. We also distribute a framework build.
Using CocoaPods
// Podfile
pod 'ParcelKit', '~> 2.1'
and
pod install
Framework
- Open the ParcelKit.xcodeproj project
- Select the “Framework” scheme
- Build (⌘B) the Framework
- Open the Products section in Xcode, right click “libParcelKit.a”, and select “Show in Finder”
- Drag and drop the “ParcelKit.framework” folder into your iPhone/iPad project
- Edit your build settings and add
-ObjC
to “Other Linker Flags”
Usage
Include ParcelKit in your application.
#import <ParcelKit/ParcelKit.h>
Initialize an instance of the ParcelKit sync manager with the Core Data managed object context and the Dropbox data store that should be used for listening for changes from and writing changes to.
PKSyncManager *syncManager = [[PKSyncManager alloc] initWithManagedObjectContext:self.managedObjectContext datastore:self.datastore];
Associate the Core Data entity names with the corresponding Dropbox data store tables.
[syncManager setTable:@"books" forEntityName:@"Book"];
Start observing changes from Core Data and Dropbox.
[syncManager startObserving];
Hold on to the sync manager reference.
self.syncManager = syncManager;
Set up Core Data
ParcelKit requires an extra attribute inside your Core Data model.
- syncID with the type String. The Indexed property should also be checked.
Make sure you add this attribute to each entity you wish to sync.
An alternative attribute name may be specifed by changing the syncAttributeName property on the sync manager object.
Documentation
- ParcelKit Reference documentation
Example Application
- Toado - Simple task manager demonstrating the integration of Core Data and Dropbox using ParcelKit.
Requirements
- iOS 6.1 or higher
- Dropbox Sync SDK 3.1.0 or higher
- Xcode 5 or higher
License
MIT.