General question on learning with OS4 vs OS3


#1

Hi,

I started my iPhone learning less than a month ago, on XCode 3.2.2 with iPhone OS 3.2 (the last rev was before 4.0). This matched up with current iPhone (SDK 3) learning resources, including this book.

Then I upgraded to XCode 3.2.3 and its SDK for iOS 4. I’m noticing where the SDK is updated to accommodate iOS4. For example, the new way the y-axis behaves for CA shadows. Or I was looking up some API details on Core Animation transactions, and I noticed that the beginAnimations:context: method is deprecated in favor of blocks. The fact that base SDKs are specified differently is the most obvious, when opening older sample code projects.

I know multiple SDKs can be installed, although I wasn’t sure if installing an older one would give me trouble due to that shared component.

Are there any known “gotchas” if I continue working through the book and XCode 3.2.3 with base sdk 4.0? I’m on chapter 7 and okay so far.

Thanks!


#2

I’m currently working on the 2nd edition of the book (which will be updated for iOS 4.0, Xcode 4 and have a few more iPad specific things). So far, I’ve found two show stoppers in the original content when working with iOS 4.0:

In the Archiving chapter, when asked to implement applicationWillTerminate: to save out the data, you will instead implement applicationDidEnterBackground: to perform the same code.

The movie player in the media chapter also doesn’t work because of the change to playing movies. This one requires a much bigger change because of a bug that exists in iOS 4.0. You’ll need to make the MediaPlayer application use a view controller and then add the moviePlayer’s view to the view controller’s view and set the frame of the moviePlayer’s view.

- (void)viewDidLoad
{
    [[self view] addSubview:[moviePlayer view]];
   CGRect rect = [[self view] bounds];
   rect.origin.y = rect.size.height / 2.0;
   rect.size.height /= 2.0;
   [[moviePlayer view] setFrame:rect];
}

#3

Thanks Joe, I’ve filed that for future reference.