Here is my code , how to convert this into API v2 compitable methods.
-(void)prepareForRecoverDB{
if(![Utility isNetworkAvailable]) {
[Utility showAlertViewWithTitle:@Error! Message:@Unable to connect to the host. Please check your network connection. CancelTitle:@OK];
return;
}
[self showLoadingView];
DBMetadata *mData = [self.arrOfBackupFiles objectAtIndex:self.indexPath_.row];
AppDelegate_Shared *appDelegate = (AppDelegate_Shared *)[UIApplication sharedApplication].delegate;
DBRestClient *aClient = [[DBRestClient alloc] initWithSession:[DBSession sharedSession]];
aClient.delegate = self;
NSString *strPath = [appDelegate dbPath];
NSArray *arrPath = [strPath componentsSeparatedByString:@/];
NSString *lastPath = [arrPath lastObject];
if([lastPath isEqualToString:mData.filename]){
self.restoredFileName = @RentTracker.sqlite;
[aClient loadFile:mData.path intoPath:[appDelegate dbPath:self.restoredFileName]];
}
else{
[aClient loadFile:mData.path intoPath:[appDelegate dbPath:mData.filename]];
self.restoredFileName = mData.filename;
}
}
- (void)restClient:(DBRestClient*)client loadedFile:(NSString*)localPath {
[self hideLoadingView];
[Utility showAlertViewWithTitle:@Restored! Message:@File Restored Sucessful! CancelTitle:@OK];
[[DBSession sharedSession] unlinkAll];
AppDelegate_Shared *app = (AppDelegate_Shared *)[UIApplication sharedApplication].delegate;
NSFileManager *fm = [NSFileManager defaultManager];
[fm removeItemAtPath:[app dbPath] error:nil];
[[NSUserDefaults standardUserDefaults] setValue:self.restoredFileName forKey:kStoreName];
[[NSUserDefaults standardUserDefaults] synchronize];
app.managedObjectModel = nil;
app.managedObjectContext = nil;
app.persistentStoreCoordinator = nil;
[self.navigationController popViewControllerAnimated:YES];
}