Substitua um banco de dados SQLite no tempo de execução

Estive desenvolvendo um aplicativo que exigia a substituição do arquivo de banco de dados SQLite no tempo de execução. Tenho código para substituir o db, mas não atualizar o banco de dados ainda mostra os dados antigos. Por favor me guie

Isto é para obter o arquivo e substituir

ASIHTTPRequest *requestToDownloadDB = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:@"http://www.turfnutritiontool.com/dev.ios/services/turfnutritiontool_ver_two.db"]];
                // ======================================================================================================
                // All methods below remove old store from coordinator
                // ======================================================================================================

                NSError *error = nil;
                NSPersistentStore *persistentStore = [[self.persistentStoreCoordinator persistentStores] objectAtIndex:0];
                [self.persistentStoreCoordinator removePersistentStore:persistentStore error:&error];
                if (error) {
                    NSLog(@"error removing persistent store %@ %@", error, [error userInfo]);
                }

                // then update 
                //NSString *documentsDirectory = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
                //documentsDirectory = [documentsDirectory stringByAppendingPathComponent:@"turfnutritiontool_ver_two.db"];

                NSURL *applicationDocumentsDirectory = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
                NSURL *storeURL = [applicationDocumentsDirectory URLByAppendingPathComponent: @"turfnutritiontool_ver_two.db"];

                NSLog(@"This is store URL %@ ", storeURL);

                [requestToDownloadDB setDownloadDestinationPath:[NSString stringWithString:[storeURL absoluteString]]];
                [requestToDownloadDB startSynchronous];

                // add clean store file back by adding a new persistent store with the same store URL
                if (![self.persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType 
                                                                   configuration:nil 
                                                                             URL:storeURL 
                                                                         options:nil 
                                                                           error:&error]) {
                    NSLog(@"failed to add db file, error %@, %@", error, [error userInfo]);
                }

Pelase, dê uma olhada no meu código depois de adicionar o seu códig

Estou recebendo o

NSLog(failed to add db file, error (null), (null));

o que eu deveria fazer agor

questionAnswers(4)

yourAnswerToTheQuestion