Search
Rich's Mad Rants
Powered by Squarespace

Creating iOS 5 Apps Discussion > Page 308 - clarification where to add code

The text states to add the following code to initWithFileURL:, however does not specifically state where to insert this code. The file is WeightHistory.m, and the specific location is within the if conditional block, so that initWithFileURL: completed is...

- (id)initWithFileURL:(NSURL *)url
{
self = [super initWithFileURL:url];

if (self)
{
// Set an initial defaults
_weightHistory = [[NSMutableArray alloc] init];

// Monitor document state
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(documentStateChanged:) name:UIDocumentStateChangedNotification object:self];
}

return self;
}

December 28, 2011 | Unregistered CommenterScott

Sorry if that wasn't clear.

The first two lines in the sample code (the ones in black) were supposed to be the guides. While the blue code is the new code. I cut out a lot of the method to save space. I'd hoped the initial two lines gave enough context--but I could probably use a bit more to make it clear.

Thanks,

-Rich-

December 29, 2011 | Registered CommenterRichard Warren