Chapter 5 and AppController

Post any questions or comments you have about the book, example code, etc.

Chapter 5 and AppController

Postby kjpou1 » Mon Feb 08, 2010 12:33 am

Hello all

Started the e-book yesterday. So far really great. Did get a little confused with the differences between the two versions of xcode, the one I am using on snow leopard (3.2.1) and the screen shots in the book.

It looks like a lot of it is done automatically for us now so that is good.

In chapter 4 we used VillainTrackerAppDelegate.m for all of our implementation code which was automatically created for with 3.2.1. It all works fine.

Now on to my question.

Have a small question on starting chapter 5. It says:

Preparing AppController for Multiple Villains
In Xcode, open the project you created in Chapter 4, and navigate to AppController.h so we can update the class’s interface to accommodate our upcoming changes. First, we’ll add the new instance variables we need.


Ok that is fine but in the project there is no AppController.h or .m. I guess I missed a piece somewhere in chapter 4 or in the interface builder, correct? The AppController.h and AppController.m file looks to contain the same information that we have in VillainTrackerAppDelegate.m to start off chapter 5. So do I need to go back to chapter 4 and create an AppController or continue on with the code changes in VillainTrackerAppDelegate. Should I go back and delete the two classes that were generated for us and do it the way in the book? That seems a little weird to have to do this though if they are created automatically.

To continue on will do the code changes in VillainTrackerAppDelegate but really would like to do this correctly instead of finding out later that I have wasted my time.

Thanks in advance

Kenneth
kjpou1
 
Posts: 11
Joined: Mon Oct 19, 2009 7:34 pm

Re: Chapter 5 and AppController

Postby jacknutting » Mon Feb 08, 2010 5:49 pm

Hi Kenneth, glad to hear you're enjoying the book! Looks like you've found and reported the first bit of errata: The class referred to as AppController in chapter 5, and as VillainTrackerAppDelegate in chapter 4, are one and the same. Go ahead and use the VillainTrackerAppDelegate class from chapter 4, while making the changes described in chapter 5.

//jack
jacknutting
 
Posts: 24
Joined: Thu Feb 04, 2010 9:32 am

Re: Chapter 5 and AppController

Postby kjpou1 » Mon Feb 08, 2010 11:51 pm

jacknutting wrote:Hi Kenneth, glad to hear you're enjoying the book! Looks like you've found and reported the first bit of errata: The class referred to as AppController in chapter 5, and as VillainTrackerAppDelegate in chapter 4, are one and the same. Go ahead and use the VillainTrackerAppDelegate class from chapter 4, while making the changes described in chapter 5.

//jack


Thanks Jack

Did that and all is working fine. Will post more errata that I found in a second post.

Kenneth
kjpou1
 
Posts: 11
Joined: Mon Oct 19, 2009 7:34 pm

Re: Chapter 5 and AppController

Postby nidzo » Wed Mar 17, 2010 3:18 pm

Hi, guys, first just to say the book is really great! it would take me tons more time to figure out these things that are just thrown at me here...

I couldn't find on this forum that anybody pointed out to this little thing so I wanted to post it (if I missed it and it's posted somewhere else, excuse me):
in the newVillain method on p. 102
compiling in SnowLeopard 10.6.2 in 64-bit I get a warning something like: ...makes pointer from integer without a cast
and than when I try to click the plus button, newVillain method makes the application abort with signal EXC_BAD_ACCESS

this is what I changed:
instead of : [villainsTableView selectRow:[villains count]-1 byExtendingSelection:NO];
I put : [villainsTableView selectRowIndexes:[NSIndexSet indexSetWithIndex:[villains count]-1] byExtendingSelection:NO];

I don't get the warning anymore, adding new items to the table view works just fine... no abort anymore...

Nidzo
nidzo
 
Posts: 3
Joined: Sat Feb 27, 2010 10:03 am

Re: Chapter 5 and AppController

Postby ScottW » Sat Mar 20, 2010 2:52 pm

Another small typo/Snow Leopard difference: When you're using the automatically generated VillainTrackerAppDelegate, the window IBOutlet is already set up for you. The book had this in bold, indicating this needed to be added.
Scott Wiesner
Boulder, Colorado
ScottW
 
Posts: 10
Joined: Sat Mar 20, 2010 1:56 pm

Re: Chapter 5 and AppController

Postby color_blind » Mon Jul 12, 2010 9:43 am

Thanks, Nidzo! I had this same problem, couldn't figure out the trick.
color_blind
 
Posts: 1
Joined: Mon Jul 12, 2010 9:41 am


Return to Book-related stuff

Who is online

Users browsing this forum: No registered users and 1 guest