Implementing downloadData

Implementing downloadData

You can remove the next warning by implementing the downloadData method in DataAccess.m.

The downloadData method is responsible for requesting the initial data you require from the Relativity Server.

The sample application is a simple application, so you can just ask for all the data from the Tasks and Priorities tables.

Change the downloadData method to look like the one below.

//DataAccess.m
- (void)downloadData {
    NSDictionary *tables = [rda getDataTables:@[@"Priorities", @"Tasks"]];
    self.prioritiesTable = tables[@"Priorities"];
    self.tasksTable = tables[@"Tasks"];
}

Then add two properties in DataAccess.h.

//DataAccess.h
@property (retain) DADataTable *tasksTable;
@property (retain) DADataTable *prioritiesTable;

In downloadData, the code [rda getDataTables:@[@"Priorities", @"Tasks"]]; asks the DARemoteDataAdapter (that's the class that handles all communication with the Relativity Server), pointed to by the rda variable, to return all the data stored in the Priorities and Tasks tables.

NOTE: In this example you don't have much data, so asking for all the data won't be a problem.

The getDataTables method returns a dictionary of DADataTable objects, which get assigned to two new properties you have added to the DataAccess class. The properties are public, as they are declared in DataAccess.h, because this is how the rest of your application is going to access the data from the Relativity Server.