jeudi 29 octobre 2015

Core Data Managed Object unable to save context (Error 134030)

when trying to save a managed object with the following configuration in the persistent store coordinator:

    NSURL *storeURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"ParallelPhotosModel.sqlite"];
NSError *error = nil;
NSString *failureReason = @"There was an error creating or loading the application's saved data.";
if (![_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:nil error:&error]) {

i get the following error:

Unresolved error Error Domain=NSCocoaErrorDomain Code=134030 "An error occurred while saving." UserInfo={NSFilePath=/var/mobile/Containers/Data/Application/9FCED2FF-F976-4780-8192-208519C8CD11/Documents/ParallelPhotosModel.sqlite, NSAffectedStoresErrorKey=( " (URL: file:///var/mobile/Containers/Data/Application/9FCED2FF-F976-4780-8192-208519C8CD11/Documents/ParallelPhotosModel.sqlite)" ), NSUnderlyingError=0x127335c50 {Error Domain=NSCocoaErrorDomain Code=4 "The file doesn’t exist." UserInfo={NSUnderlyingError=0x12732a670 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory" UserInfo={NSFilePath=/var/mobile/Containers/Data/Application/9FCED2FF-F976-4780-8192-208519C8CD11/Documents/ParallelPhotosModel.sqlite}}}}}, { NSAffectedStoresErrorKey = ( " (URL: file:///var/mobile/Containers/Data/Application/9FCED2FF-F976-4780-8192-208519C8CD11/Documents/ParallelPhotosModel.sqlite)" ); NSFilePath = "/var/mobile/Containers/Data/Application/9FCED2FF-F976-4780-8192-208519C8CD11/Documents/ParallelPhotosModel.sqlite"; NSUnderlyingError = "Error Domain=NSCocoaErrorDomain Code=4 \"The file doesn\U2019t exist.\" UserInfo={NSUnderlyingError=0x12732a670 {Error Domain=NSPOSIXErrorDomain Code=2 \"No such file or directory\" UserInfo={NSFilePath=/var/mobile/Containers/Data/Application/9FCED2FF-F976-4780-8192-208519C8CD11/Documents/ParallelPhotosModel.sqlite}}}"; }

what is the underlying problem here and how do i avoid it? I ve seen somewhere that a similar error pops up when trying to save inside the App bundle but the storeURL i m using was taken from a tutorial (that is the documents directory).

Aucun commentaire:

Enregistrer un commentaire