Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Source code archive for the book

The source code archive for Beginning iOS 5 Development, containing all the projects built in the book, is hosted at iphonedevbook.com. Head over there to download the latest!

Comments

  • Where would be the best place to send mistakes/changes in the book? Here, email or Apress?
  • Definitely here! Just post a new topic in the relevant section with any problems you find. Both Learn Cocoa on the Mac and Beginning iOS 5 Dev are currently being revised for future editions, so any problem reports will be helpful! TIA //jack
  • Hi Jack,

    Caveat: I'm new to programming in general.

    Chapter 6 is giving me one problem, but I have found a few differences in current source code compared to the book (Beg iOS 5 Dev).  

    I decided to use Xcode 4.5, targeting iOS 6, in the OS 10.8 environment.  This way after testing the book code against the new Xcode I can determine where things are different and try and get those solutions implemented in the basic productivity app I'm creating.

    The problem is: when I RUN my program the TOOLBAR does not show up and I don't have access to the Switch Views button to make the switch.  The alert button works just fine in the BLUE VIEW which is the one that is showing.  I have been over the instructions for connecting the buttons and making the connections from the FILE OWNER to the VIEW many times.  I include below the comments I created for myself, and implemented, showing the difference between the book and the current source code from Sept. ~25.

    Pg. 144 - Xcode 4.5 does not have a pre-defined UIViewController subclass template.  
    COMMENT: You can use Objective-C class instead of UIViewController subclass to achieve the same thing.
    (I did this but I'm not sure if something got lost in translation)

    Pg. 152 - The source code and book differ in the BIDSwitchViewController.m file.
    COMMENT: 
    The new Xcode 4.5 templates and the book instructions are missing the following in BIDSwitchViewController.m file:
    - (void)viewDidUnload
    {    
    [super viewDidUnload];
        // Release any retained subviews of the main view.
        // e.g. self.myOutlet = nil; 
    }
    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait); 
    }

    Pg. 158 - BIDYellowViewController.m and BIDBlueViewController.m are missing code as well.
    COMMENT:
    Book's source code did not include the ViewDidLoad method in the BIDYellow(and Blue)ViewController.m file. It does contain, at end:
    - (void)viewDidUnload
    {
        [super viewDidUnload];
        // Release any retained subviews of the main view.
        // e.g. self.myOutlet = nil;
    }

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
    {
        // Return YES for supported orientations
        return (interfaceOrientation == UIInterfaceOrientationPortrait);
    }

    Pg. 159 - Getting a log message, but not a perceived coding error.
    COMMENT: Getting a message in the log window:
    2012-09-30 04:24:31.288 View Switcher[1227:c07] Application windows are expected to have a root view controller at the end of application launch
    (Okay, I'm clueless).

    Pg. 160 - In the source code you use "nil" in the following line of code, but "NULL" in the book. 
    [UIView beginAnimations:@"View Flip" context:nil]; 
    (Did not make a difference to my TOOLBAR problem).

    Help (she said, squeaking like a mouse).

  • Ahhhh... Enlightenment.  Simple error on my part.  In the TOOLBAR exercise from Chapter 6 (Beg iOS 5 Dev) I mistakenly left the Simulated metric SIZE at Retina 4 Full Screen (Apples Default).  That kept the Toolbar from showing up.  All other notes from my earlier post still apply.  But my application works perfectly.
  • Hi Jack,

    I hit a snag in Chapter 9 (of Beg iOS 5 Dev) on page 340.  I keep getting an error message for the UITableViewCellStyleDefault line.  The error is that it is deprecated in iOS6.  I went to the documentation but there does not seem to be a solution.  Please keep in mind I'm a total novice at this and I may not understand what I'm looking at.  Funny thing is, I looked at your source code and it works fine with no error. I copied it over and I get an error.  If you have a suggestion on how to get around it, that would help me out a great deal.

    Thanks
  • Hi Jack,

    Okay, I thought the error was for line 'UITableViewCellStyleDefault' but coming back at it I realized that the error was actually on line 'label.textAlignment = UITextAlignmentRight;' (Beg iOS 5 Dev, pg 340), just a few lines down.  The error said that it was deprecated in iOS6 and when I control clicked and looked up the definition of 'UITextAlignmentRight' Apple recommends we now use 'NSTextAlignmentRight'.  I used  this but still found I had an error somewhere else on the page but referring back to the 'UITextAlignmentRight' problem. At that point I figured the error handling system might be a bit messed up so I copied the entire page of code from your source files and corrected to the 'NSTextAlignmentRight'.  It worked.
  • Hi there,

    Sorry about the late reply, I've been busy as a beaver working on the next edition of the book. Several of the problems you've found are really symptoms of a thing we have to deal with all the time: Apple changes the way Xcode works, or changes the project or file templates, and suddenly our book has become "wrong"!

    One thing worth mentioning, a substantial change in iOS 6, is that viewDidUnload is deprecated and is no longer called. If all you're doing there is freeing resources, then it doesn't matter (they'll be freed up when the object is deallocated anyway), but if there are other things happening in viewDidUnload, they should be moved to viewWillDisappear or viewDidDisappear. I think there were just one or two spots in current edition of the book where this was an issue. In almost all of the examples, you can now just skip everything we say about viewDidUnload.
  • Jack, thank you for replying to my email and pointing me at the blog.

    I'm using Beginning iOS 5 Development on Xcode 4.51/iOS6/Mountain Lion and I've been having a few problems.

    I'd spotted the viewDidUnload, but I also find that connecting an outlet doesn't seem to be generating a @synthesize in viewController.m. I can get round that one.

    While typing this I've sorted out the major problem that got me writing to you in the first place - it was an RTFM (or more accurately RTFM more carefully) so thanks for being there to help me state the problem and find the solution.
  • Hi John,

    Ah, that's one more new trick that the new Xcode has up its sleeve. I'll start a new topic and describe it there.

    //jack
  • I just got Beginning iOS 6 development from Amazon.com. Where's the updated source code? You've still got the code from the iOS 5 book up here.
  • For now, you'll find it here:


    //jack
  • edited January 2013
    Ah, I just sent an e-mail about that asking the same thing. Can't you put up a link to the source on the website as I'm sure many readers have trouble finding it.
  • There are actually instructions on http://learncocoa.org, the section describing the book tells you to navigate to Apress and download from there. Maybe I should make that easier to spot!

    //jack
Sign In or Register to comment.