Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't preload data from Data sqlite to my core data
    primarykey
    data
    text
    <p>I am trying to preload a sqlite database to my core data sqlite. I got first the sqlite from the simulator and then I filled some data in. </p> <p>The problem is that I can not get data from the filled .sqlite in my root Directory to the coreData .sqlite(this file is store in the simulator)</p> <p>I have tried with the apple example <a href="https://developer.apple.com/library/ios/samplecode/CoreDataBooks/Introduction/Intro.html" rel="nofollow">CoreDataBooks</a> but I does not work. </p> <pre><code>- (NSPersistentStoreCoordinator *)persistentStoreCoordinator { if (__persistentStoreCoordinator != nil) { return __persistentStoreCoordinator; } NSURL *storeURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"MyData.sqlite"]; NSFileManager *fileManager = [NSFileManager defaultManager]; // If the expected store doesn't exist, copy the default store. if (![fileManager fileExistsAtPath:[storeURL path]]) { NSURL *defaultStoreURL = [[NSBundle mainBundle] URLForResource:@"MyData" withExtension:@"sqlite"]; if (defaultStoreURL) { [fileManager copyItemAtURL:defaultStoreURL toURL:storeURL error:NULL]; } } NSDictionary *options = @{NSMigratePersistentStoresAutomaticallyOption: @YES, NSInferMappingModelAutomaticallyOption: @YES}; __persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel: [self managedObjectModel]]; NSError *error; if (![__persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:options error:&amp;error]) { NSLog(@"Unresolved error %@, %@", error, [error userInfo]); abort(); } return __persistentStoreCoordinator; } - (NSURL *)applicationDocumentsDirectory { return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload