Created
January 25, 2011 15:19
-
-
Save blakewatters/795054 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is typically configured as a secondary target on your project | |
// Dump your seed data out of your backend system in JSON format | |
// Add to the project as resources | |
// Run the secondary target in the Simulator | |
- (void)seedTheDatabase { | |
// Setup the object manager | |
RKObjectManager* objectManager = [RKObjectManager objectManagerWithBaseURL:@"http://restkit.org"]; | |
objectManager.objectStore = [[RKManagedObjectStore alloc] initWithStoreFilename:@"ContactsSeed.sqlite"]; | |
// Load all the data from the file contacts.json into a seed database | |
// The seeder will print instructions for how to copy the data to your app | |
RKObjectSeeder* seeder = [[RKObjectSeeder alloc] initWithObjectManager:objectManager]; | |
[seeder seedDatabaseWithBundledFile:@"contacts" ofType:"json"]; | |
[seeder finalizeSeedingAndExit]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment