In my app I create and use a normal persistent store:
- (NSPersistentStoreCoordinator *) persistentStoreCoordinator {
// D_IN;
if (persistentStoreCoordinator != nil) {
return persistentStoreCoordinator;
}
persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel: [self managedObjectModel]];
// Allow inferred migration from the original version of the application.
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption,
[NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil];
NSURL *storeUrl = [NSURL fileURLWithPath: [[self applicationDocumentsDirectory] stringByAppendingPathComponent: @"Dances005.sqlite"]];
NSError *error = nil;
if (![persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeUrl
options:options error:&error]){
NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
}
// D_OUT;
return persistentStoreCoordinator;
..nothing special. It contains several NSData objects - all core data compliant on iPhone and iPAD.
I create the file on the iPhone and would like to copy it to the iPAD. When I open the same app on the iPAD it uses the copied sqlite and works fine as long as it reads/fetches. As soon as I change the data and need to store back I get the following error:
Unresolved error Error Domain=NSCocoaErrorDomain Code=256 UserInfo=0x6a2b7a0 "Operation could not be completed. (Cocoa error 256.)", {
NSFilePath = "/var/mobile/Applications/294B329D-D287-4012-A551-4E7348624225/Documents/Dances005.sqlite";
NSUnderlyingException = error during SQL execution : attempt to write a readonly database;
Currently I use iPhoneExplorer and just drag the file from iPhone -> MAC -> iPAD. I checked the rw Attributes with iFile and they are rw for the user on the iPAD. (same as on iPhone)
What could be the problem here and how can I solve this?