Xcode 4 Book Status Update (Late April)
The book is still several weeks away from being finished. I’m not sure if I can reach my goal of finishing the ebook in May, but if I do reach the goal, it will be late May. I am working on the book every day and making steady progress. When the book is finished, I will update this blog and the book’s website.
Saving a Property List in a File Wrapper
Saving a property list in a file wrapper takes two steps. First, call NSPropertyListSerialization’s dataFromPropertyList: or dataWithPropertyList: methods to create a property list. The dataWithPropertyList: method was introduced in Mac OS X 10.6. Use dataFromPropertyList: if you are supporting earlier versions of Mac OS X.
NSMutableDictionary* root;
NSError* error;
NSData* propertyList = [NSPropertyListSerialization dataWithPropertyList:root format:NSPropertyListXMLFormat_v1_0 options:0 error:&error];
Second, pass the property list you created as the first argument to NSFileWrapper's addRegularFileWithContents: method.
NSFileWrapper* wrapper;
[wrapper addRegularFileWithContents:propertyList preferredFilename:@"MyFile.plist"];
My Working with Cocoa File Packages post has detailed information on file packages. Read Apple's Property List Programming Guide for more information on property lists.
Xcode 4: Finding the Application You Built
Previous versions of Xcode created a build folder inside your project folder and placed your application there. Xcode 4 stores build products in the following location:
/Users/Username/Library/Developer/Xcode/DerivedData
When you build the project, Xcode creates a folder for your project in the derived data folder and places the files it creates in that folder. If you want your derived data in a different location, open Xcode’s Location Preferences. Choosing File > Project Settings lets you change the derived data location for a single project.
Update
You can also open the folder where your application resides using the Xcode project window. Click the disclosure triangle next to the Products folder in the project navigator. Select the application, right-click, and choose Show in Finder.
Xcode 4: Finding User Interface Elements
One of Xcode 4′s biggest changes is its integration with Interface Builder. There is no longer a separate Interface Builder application. Select a xib file from the project navigator to create your application’s user interface. You may be wondering where the user interface elements are located in Xcode 4.
They are in the object library. Choose View > Utilities > Object Library to open the object library, which is located in the lower right corner of the project window.

Xcode 4: Unit Testing Support
Developers doing test-driven development with the Cocoa and Cocoa Touch frameworks will like the improved support Xcode 4 has for unit testing. When you create a project that uses the Cocoa or Cocoa Touch frameworks, such as a Cocoa or iPhone application, Xcode gives you the option to add a unit testing bundle to the project.

When you select the Include Unit Tests checkbox, Xcode adds a unit testing bundle and a unit testing class to the project. Xcode also sets the Bundle Loader and Test Host build settings for the unit testing target and creates a target dependency so you can automatically run the unit tests.
Another change Apple made to unit testing in Xcode 4 is adding the Test After Build build setting. When you set the Test After Build build setting to YES, Xcode runs your unit tests after building the unit testing target. Choose Product > Build For > Build For Testing to build the unit testing target. The test results appear in the build results window. Read my Opening the Build Results Window post for more information on opening the build results window. If Test After Build is set to NO, you must run the tests by choosing Product > Test. Open the log navigator to view the test results. I found unit testing works better when setting Test After Build to YES.
If you open the scheme editor (use the Scheme pop-up menu in the project window toolbar), you can specify what tests are run as well as run scripts before and after running the tests. Xcode initially is set to run all tests.