Loading Data into MPRDocument

Importing the .csv file is simple—most of the work was done on the iOS side. Add sample-data.csv to the project, declare

- (IBAction) fillWithData: (id) sender;

in MPRDocument.h and put

#import "PRGame.h"    .    .    .- (IBAction) fillWithData: (id) sender{    NSString *  dataPath =    [[NSBundle mainBundle] pathForResource: @"sample-data"                                   ofType: @"csv"];    [PRGame loadFromCSVFile: dataPath                intoContext: self.managedObjectContext                      error: NULL];}into MPRDocument.m.

Note

Action methods, which respond to triggers from user-interface elements, are by convention given the return type IBAction ...

Get Xcode 5 Start to Finish: iOS and OS X Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.