Snippet Demo Method

Throughout this book there’s code that demonstrates a point and yet isn’t required in the final application. Listing 2.2 shows a new demo method along with an updated applicationDidBecomeActive method that calls demo after ensuring Core Data is ready with [self cdh].

Listing 2.2 AppDelegate.m: demo

- (void)demo {    if (debug==1) {        NSLog(@"Running %@ '%@'", self.class, NSStringFromSelector(_cmd));    }}- (void)applicationDidBecomeActive:(UIApplication *)application{    if (debug==1) {        NSLog(@"Running %@ '%@'", self.class, NSStringFromSelector(_cmd));    }    [self cdh];    [self demo];}

Update Grocery Dude as follows to implement the demo method:

1. Add the demo method from

Get Learning Core Data for iOS: A Hands-On Guide to Building Core Data Applications 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.