Skip to content

Instantly share code, notes, and snippets.

@FlaviuSim
Created March 1, 2012 12:49
Show Gist options
  • Save FlaviuSim/1949656 to your computer and use it in GitHub Desktop.
Save FlaviuSim/1949656 to your computer and use it in GitHub Desktop.
NSString *storePath = [[[selfapplicationDocumentsDirectory] URLByAppendingPathComponent: @"CoreDataStore.sqlite"] path];
// Check if the store exists in.
if (![[NSFileManagerdefaultManager] fileExistsAtPath:storePath]) {
// copy the payload to the store location.
NSString *bundlePath = [[NSBundlemainBundle] bundlePath];
NSString *bundleStore = [bundlePath stringByAppendingPathComponent:@"persistentStore"];
NSError *error = nil;
[[NSFileManagerdefaultManager] copyItemAtPath:bundleStore toPath:storePath error:&error];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment