small medium large xlarge

Back to: All Forums  Core Data
Generic-user-small
30 Oct 2008, 19:49
Brad Gibbs (7 posts)

I’m getting an error for the following code on page 20:

id recipe = [[recipeArrayController selectedObjects] lastObject];

saying that recipeArrayController is undeclared. This is sensible, since it hasn’t been declared. Where should it be declared?

Also, the action needs to be declared in the header file before IB will pick up on it:

  • (IBAction)addImage:(id)sender;

This isn’t explicitly mentioned in the text.

Finally, a private method to get the application support folder is added to the code, but not mentioned in the text:

@interface AppDelegate()

  • (NSString*)applicationSupportFolder;

@end

Avatarsmall_pragsmall
08 Nov 2008, 17:30
Marcus S. Zarra (284 posts)

Brad,

Thanks for catching the lack of clarity in the header. Those errors will be cleaned up in the next beta.

As for the -applicationSupportFolder, that method is actually included in the Core Data template.

Dscf2571_2_pragsmall
10 Nov 2008, 21:05
Michael Sherman (2 posts)

I’m still missing where and how to declare the recipeArrayController.

Generic-user-small
10 Nov 2008, 23:37
Ashley Mills (3 posts)

You just need to add

@IBOutlet NSArrayController *recipeArrayController;@

to Grokking_Recipes_AppDelegate’s @interface , and then hook it up in Interface Builder.

Avatarsmall_pragsmall
12 Nov 2008, 05:44
Marcus S. Zarra (284 posts)

I would suggest reviewing the source code examples that can be downloaded for the book as the header is fully realized there. In addition the next release of the beta will have this oversight corrected.

You must be logged in to comment