Home > Store

Xcode 4 Unleashed, 2nd Edition

Register your product to gain access to bonus material or receive a coupon.

Xcode 4 Unleashed, 2nd Edition

Book

  • Sorry, this book is no longer in print.
Not for Sale

About

Features

  • Thoroughly updated to cover the latest Apple developer tools for Mac OS X Lion and iOS 5, including Xcode 4's new single-window interface
  • Shows how to make the most of Apple's powerful tools for building effective user interfaces, optimizing code, and accelerating development
  • Covers the new Xcode Assistant, LLVM Compiler 2.0, Fix-It, launch schemes, instrumentation, and more

Description

  • Copyright 2012
  • Dimensions: 7" x 9-1/8"
  • Edition: 2nd
  • Book
  • ISBN-10: 0-672-33327-9
  • ISBN-13: 978-0-672-33327-9

In Xcode 4 Unleashed, renowned Mac/iOS developer Fritz Anderson shows how to use Apple’s powerful new Xcode 4 integrated development environment to develop outstanding software with the least effort possible.

Anderson demonstrates Xcode 4 by walking through the construction of three full applications: a command-line tool, an iOS app, and a Mac OS X application. These case-study projects offer practical insights and realistic best practices for efficiently utilizing Xcode 4 in day-to-day development.

Next, he drills down to offer an even deeper understanding of Xcode 4’s most powerful capabilities. Through practical examples, he shows experienced Apple developers how to move to Xcode 4’s “browser” model from older document-based approaches. You’ll also find thorough, up-to-the-minute coverage of key tasks ranging from builds and profiling to documentation.

He concludes with a chapter-length roundup of “tips, traps, and features” for maximizing your productivity with Xcode 4—whether you’re writing iOS apps or Mac applications, working solo, or as part of a large development team.

Detailed information on how to…

  • Get started fast with Xcode 4 project workflow
  • Master Xcode 4’s new features and development paradigms
  • Construct modern iOS and Mac user interfaces with Interface Builder
  • Implement Model-View-Controller designs in iOS apps
  • Use Storyboard to specify an iOS app’s entire structure in one file
  • Leverage Xcode’s first-class unit testing and measurement tools
  • Master the essentials of iOS provisioning
  • Use Mac OS X bindings to simplify the link between data and screen
  • Quickly localize Mac and iOS software for new languages and markets
  • Package and share subprograms that can be integrated into any OS X application
  • Use the Xcode Build System to move from source files to executable products
  • Fully understand and optimize performance and resource usage
Register your copy today at informit.com/register to download a free 90+ page guide to 4.4 & 4.5 feature changes

Downloads

Downloads

Download free code files here

Sample Content

Online Sample Chapter

Xcode 4 Unleashed: Starting an iOS Application

Sample Pages

Download the sample pages (includes Chapter 8 and Index)

Table of Contents

Introduction     1
Part I   First Steps

1   Getting Xcode     9
Before You Do Anything     9
Requirements     10
Installing Xcode.     10
What You Get     11
Removing Xcode.     12
Apple Developer Programs     12
Through an Installer Package     13
Summary     15

2   Kicking the Tires 17
Starting Xcode     17
Hello World     19
  A New Project     19
  Quieting Xcode Down     21
  Building and Running     21
The Real Thing     23
Getting Rid of It     23
Summary     24

3   Simple Workflow and Passive Debugging     25
Building     28
Running     30
Simple Debugging     32
Summary     33

4   Active Debugging     35
A Simple Test Case     35
Going Active     35
  Setting a Breakpoint.     36
  The Variables Pane     37
  Stepping Through     38
Fixing the Problem     40
  Behaviors     40
  The Fix     42
Summary     43

5   Compilation      45
Compiling     46
Linking     50
Dynamic Loading     51
Xcode’s Refinements     52
Compiler Products     55
  Intermediate Products     55
  Precompiled Headers     56
Summary     56

6   Adding a Library Target     57
Adding a Target     57
Targets     58
Target Membership     58
  Adding Files to a Target     59
  Headers in Targets     61
A Dependent Target     62
Adding a Library     63
Debugging a Dependent Target     63
Summary     64

7   Version Control     65
Taking Control     66
  Creating a Git Repository by Hand     66
The State of Your Files     68
  How Subversion Views Files     68
  How Git Views Files     68
  How Xcode Views Files     69
Your First Commit     70
Adding a Remote Repository     71
  Setting Up the Remote     71
  Pushing to the Remote     72
Starting from a Repository     74
Merges and Conflicts     75
  User A     75
  User B     75
  Merging     76
  Conflicts     77
The Versions View     79
  Comparison     79
  Blame     81
  Log     82
  Branching     82
Summary     84

Part II   The Life Cycle of an iOS Application

8   Starting an iOS Application     87
Planning the App     87
  Model-View-Controller     87
  The Model      88
  The Views     89
  The Controllers     90
Starting a New iPhone Project     90
  Target Editor     92
  Copyright, Again     93
One More Thing     97
Summary     98

9   An iOS Application: Model     99
Implementing the Model      99
  Entities     100
  Attributes     100
  Relationships     102
Managed-Object Classes     105
  Creating the Classes     105
  Extending the Classes     106
  Some Test Data     108
Making the Model Easier to Debug     111
Summary     111

10   An iOS Controller     113
 Renaming Symbols     113
  Refactoring a Method Name     114
  Refactoring a Class Name     114
Editing the View Controller     116
  The Table View     116
  Setting Up the Passer List     117
  Creating a New Passer     117
Live Issues and Fix-it     118
The Real Passer Rating     120
  Another Bug     120
  Running Passer Rating     123
Summary     125

11   Building a New View     127
Adding a View Controller     127
  XIB Files     128
Building a View     130
  Lots of Labels     132
  First Tryout     134
  Outlets     134
  Checking Connections     137
  Connecting GameListController     137
Code Completion and Snippets     139
Testing the Passer Detail View     141
Summary     141

12   Adding Table Cells     143
The Game Table     143
Schemes     147
A Custom Table Cell     149
Summary     154

13   Unit Testing     155
Logic Testing     156
  Test Data     158
  Testing the CSV Reader     159
Application Testing     166
SenTestingKit Assertions     168
  Simple Tests     169
  Equality     169
  Exceptions     169
Summary     170

14   Measurement and Analysis     173
 Speed     173
 Memory     182
  Allocations     182
  Leaks     187
  Zombies     189
Analysis     193
  The Analyzer     193
  Automatic Reference Counting     195
Summary     196

15   Storyboard     197
What Storyboard Is     197
A Storyboard Project     199
Reconstructing Passer Rating     201
  Workspaces     201
  Copying the Model     203
  Coding the Passer List     205
  Copying Views     205
A Custom Table View Cell     207
Adding a Passer Editor     210
  Creating the Editor View     210
  Coding the Editor Controller     212
  Adding a Segue     215
  Editing an Existing Passer     217
Summary     219

16   Provisioning     221
Developer Programs     221
  Organizations     221
  Individuals     222
  The Enterprise Program     222
The Provisioning Story     222
  Automatic Device Provisioning     223
The Provisioning Portal     225
  Development Certificates     225
  Distribution Certificates     225
  Device IDs     226
  Application IDs     227
  Development Profiles     228
  Distribution Profiles     229
Using a Signing Identity     230
Distribution Builds     231
Sharing Identities and Profiles     233
Preparing an App Store Release     234
  Final Provisioning     234
  iTunes Connect     234
  Validating and Submitting     235
Summary     236

Part III   Xcode for Mac OS X

17   Starting a Mac OS X Application      239
The Goal     239
Getting Started     240
Model     243
  Porting from iOS     243
  Automatic Reference Counting     246
Making the Application Twitch     248
  Wiring Up a Menu     248
  Loading Data into LeagueDocument     250
Summary     251

18   Wiring a Mac Application with Bindings 253
Filling the Document Window      253
  A Table View     254
  Autoresizing     255
Your First Object Controller     258
  Binding the Team Table     260
  Running Bindings     260
  Laying Out Views     263
The Passer and Game Array Controllers     264
  Binding the Passer Table     266
  The Game Table—Truncation and Dates     268
The Game Popover      269
Summary     273

19   A Custom View for Mac OS X     275
A Graphing View     276
Back to the View Controller     279
  Using PasserGraphController     281
Custom View Properties     282
Summary     283

20   Localization and Autolayout     285
Adding a Localization     286
  Trying It Out     287
  Localizing MainMenu.xib     288
Localizing the Window XIBs     291
  Translating View Strings     291 
  Making the Text Fit—by Hand     292
  Making the Text Fit—Autolayout     292
Localizing Info.plist     300
Strings in Code     302
Summary     306

21   Bundles and Packages     307
A Simple Package: RTFD     308
Bundles     309
Application Bundles     309
The Info.plist File     311
  Localizing Info.plist     312
Info.plist Keys     312
  Keys for All Bundles     312
  Keys for iOS and Mac OS X Applications     314
  Keys for Mac OS X Applications     315
  iOS Keys     320
  Keys for Plug-ins     322
  Keys for Preference Panes     323
  Keys for Dashboard Widgets     323
Summary     324

22   Frameworks     325
Adding a Framework Target     326
  Populating the Framework     326
  Using the Framework     327
Installing a Framework     327
  Running the Application Alone     328 
  Where Frameworks Are Found     330
  Putting the Framework in the Application     331
Building Mac Passer Rating     332
  One More Thing     332
Summary     336

23   Property Lists     337
Property List Types     337
Editing Property Lists     338
  A Brand New Property List     341 
  Why Not the Property List Editor?     345
Other Formats     348
  Text Property Lists     348
  Binary Property Lists     348
Specialized Property Lists     349
Summary     350

Part IV   Xcode Tasks

24   Xcode 4 for Xcode 3 Veterans     353
The Desktop and the Browser     353
  Start Slow     354
  The Sorcerer’s Apprentice     355
The Editor     355
  The Assistant Editor     355 
  More Than One Editor     356
Building     358
Where Did Everything Go?     358
  Groups & Files     358
  Detail View     360
  Info Windows     360
  Special-Purpose Editors     362
  Browsers     364
  Source Control     364
Interface Builder.     365
Other Changes     366
Summary     368

25   Documentation in Xcode     369
Intrinsic Help     369
  The Quick Help Inspector     369
  The Quick Help Popover     370
  Open Quickly     371
  Help     372
  Xcode How-To’s.     373
The Documentation Organizer     373
  Browsing Documentation     373
  Searching Documentation     374
  Bookmarks     375
Keeping Current     375
  Generating Documentation     377
  Installing Doxygen     378 
  What Doxygen Does     378
  Configuring Doxygen: The Wizard     381
  Configuring Doxygen: Expert Settings     383
  Running Doxygen     384
  Installing a Docset     385
  Making Doxygen Part of Your Builds     386
Summary     388

26   The Xcode Build System     389
Xcode Build Variables     392
Settings Hierarchy     393
  Editing Build Variables     395
Configurations     396
  Adjusting Configurations     396
  Adding Configurations     398
Configuration Files     398
  Creating a Configuration File     398
  SDK- and Architecture-Specific Settings     399
  Preprocessing xcconfig Files     399
The xcodebuild Tool     400
Custom Build Rules     401
The Build Log     403
A Simple Build Transcript     404
  Resources     406
  Precompiled Header     407
  Compiling Source Files     408
  Linking     409 
  Making a Universal Binary     410
  Touch     410
Summary     410

27   Instruments     411
What Instruments Is     411
Running Instruments      412
  The Trace Document Window     413
  The Library     419
  Instrument Configuration     420
  Recording     421
  Saving and Reopening     423
The Instruments     424
  Core Data.     424
  Custom Instruments     425
  Dispatch     425
  File System     425
  Garbage Collection     426
  Graphics     426
  Input/Output     426 
  Master Tracks     426
  Memory     426
  System     427
  Threads/Locks     429
  UI Automation     429
  User Interface.     430
  Instruments Available to iOS     430
Custom Instruments     431
The Templates     433
  For Both Mac and iOS     433
  iOS Only     434 
  Mac Only     435
Summary     435

28   Snippets     437
Tricks     437
  General     437
  The Jump Bar     440
  Code Folding Ribbon     440
  The Assistant Editor     441
  Interface Builder     442
  Instruments and Debugging     443
  Building     445 
  Managing Schemes     447
Traps     448

Part V Appendixes

A   Objective-C     455
The Basics     456
A Class Interface     457
A Class Implementation     458
Objective-C 2.0 and Cocoa.     460
  Key-Value Coding     461 
  Memory Management     462
  Attribute Accessors and Memory Management     463
  Properties     464
Fast Enumeration     467
Foundation Data Types     468
Dynamic Dispatch     470
Objective-C++.     471
Summary     471

B   Some Build Variables     473
Useful Build Variables     475
  Environment     475
  Build Targets     477
  Source Locations     478
  Destination Locations     478
  Bundle Locations     479
  Compiler Settings     480
  Search Paths     481
  Deployment     482
  Info.plist     482
Source Trees     483

C   Project and Target Templates     485
iOS Project Templates     487
  Application     487
  Framework & Library     488
  Other     488
Mac OS X Project Templates     489
  Application     489
  Framework & Library     490
  Application Plug-in     491
  System Plug-in     492
  Other     492
Target Templates     493
iOS File Templates     493
  Cocoa Touch     493
  C and C++.     494
  Core Data.     495
  Resource     495
  Other     496
Mac OS X File Templates     496
  Cocoa     496
  C and C++.     496
  User Interface     497
  Core Data     497
  Resource     497
  Other     497
The File Template Library     497

D   Resources     499
Books      499
On the Net     500
  Forums     500 
  Mailing Lists     501
  Developer Technical Support     501
  Sites and Blogs     502
Face-to-Face     503
  Meetings     503
  Classes     503
Other Software.     504
  Text Editors     504
  Accessories     505
Index 507

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020