0% found this document useful (0 votes)
114 views78 pages

0321967208

The document is a comprehensive guide titled 'Xcode 5 Start to Finish' by Fritz Anderson, focusing on iOS and OS X development. It is part of the Developer's Library Series, which offers high-quality references and tutorials for programmers on various programming languages and technologies. The book covers topics from getting started with Xcode to the life cycle of iOS applications and advanced Xcode tasks, making it a valuable resource for developers.

Uploaded by

Zhuan-Xian Mao
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
114 views78 pages

0321967208

The document is a comprehensive guide titled 'Xcode 5 Start to Finish' by Fritz Anderson, focusing on iOS and OS X development. It is part of the Developer's Library Series, which offers high-quality references and tutorials for programmers on various programming languages and technologies. The book covers topics from getting started with Xcode to the life cycle of iOS applications and advanced Xcode tasks, making it a valuable resource for developers.

Uploaded by

Zhuan-Xian Mao
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Xcode 5

Start to Finish
Developer’s Library Series

Visit developers-library.com for a complete list of available products

he Developer’s Library Series from Addison-Wesley provides


T practicing programmers with unique, high-quality references and
tutorials on the latest programming languages and technologies they
use in their daily work. All books in the Developer’s Library are written by
expert technology practitioners who are exceptionally skilled at organizing
and presenting information in a way that’s useful for other programmers.

Developer’s Library books cover a wide range of topics, from open-


source programming languages and databases, Linux programming,
Microsoft, and Java, to Web development, social networking platforms,
Mac/iPhone programming, and Android programming.
Xcode 5
Start to Finish

iOS and OS X
Development

Fritz Anderson

Upper Saddle River, NJ • Boston • Indianapolis • San Francisco


New York • Toronto • Montreal • London • Munich • Paris • Madrid
Capetown • Sydney • Tokyo • Singapore • Mexico City
Many of the designations used by manufacturers and sellers to distinguish their Editor-in-Chief
products are claimed as trademarks. Where those designations appear in this book, Mark L. Taub
and the publisher was aware of a trademark claim, the designations have been printed
with initial capital letters or in all capitals. Senior Acquisitions Editor
Trina MacDonald
The author and publisher have taken care in the preparation of this book, but make Senior Development Editor
no expressed or implied warranty of any kind and assume no responsibility for errors Chris Zahn
or omissions. No liability is assumed for incidental or consequential damages in
connection with or arising out of the use of the information or programs contained Managing Editor
herein. John Fuller

For information about buying this title in bulk quantities, or for special sales Full-Service Production
opportunities (which may include electronic versions; custom cover designs; and Manager
content particular to your business, training goals, marketing focus, or branding Julie B. Nahil
interests), please contact our corporate sales department at corpsales@pearsoned.com Copy Editor
or (800) 382-3419. Stephanie Geels

For government sales inquiries, please contact governmentsales@pearsoned.com. Indexer


Ted Laux
For questions about sales outside the United States, please contact
Proofreader
international@pearsoned.com.
Andrea Fox
Visit us on the Web: informit.com/aw Technical Reviewers
Duncan Champney
Library of Congress Cataloging-in-Publication Data Chuck Ross
Anderson, Fritz. Dan Wood
Xcode 5 start to finish : iOS and OS X development / Fritz Anderson.
pages cm Editorial Assistant
Includes index. Olivia Basegio
ISBN 978-0-321-96720-6 (pbk. : alk. paper)—ISBN 0-321-96720-8
Cover Designer
(pbk. : alk.paper)
Chuti Prasertsith
1. Mac OS. 2. iOS (Electronic resource) 3. Macintosh (Computer)—Programming.
4. iPhone (Smartphone)—Programming. 5. Application software—Development. Compositor
I. Title. LaurelTech
QA76.774.M33A53 2014
005.3’82—dc23
2014000229

Copyright © 2014 Pearson Education, Inc.

All rights reserved. Printed in the United States of America. This publication is
protected by copyright, and permission must be obtained from the publisher prior to
any prohibited reproduction, storage in a retrieval system, or transmission in any
form or by any means, electronic, mechanical, photocopying, recording, or likewise.
To obtain permission to use material from this work, please submit a written request
to Pearson Education, Inc., Permissions Department, One Lake Street, Upper Saddle
River, New Jersey 07458, or you may fax your request to (201) 236-3290.
ISBN-13: 978-0-321-96720-6
ISBN-10: 0-321-96720-8
Text printed in the United States on recycled paper at Edwards Brothers Malloy in
Ann Arbor, Michigan.
First printing, May 2014
O

For Magdalen Jeanette Anderson (1952–2013),


the mother of my children
O
This page intentionally left blank
Contents at a Glance
Contents ix
Acknowledgments xxiii
About the Author xxv

Introduction 1

I First Steps 7
1 Getting Xcode 9
2 Kicking the Tires 17
3 Simple Workflow and Passive Debugging 25
4 Active Debugging 35
5 Compilation 45
6 Adding a Library Target 63
7 Version Control 73

II The Life Cycle of an iOS Application 101


8 Starting an iOS Application 103
9 An iOS Application: Model 113
10 An iOS Application: Controller 133
11 Building a New View 147
12 Autolayout in a New View 173
13 Adding Table Cells 187
14 Adding an Editor 205
15 Unit Testing 221
16 Measurement and Analysis 237
17 Provisioning 255
viii Contents at a Glance

III Xcode for Mac OS X 275


18 Starting an OS X Application 277
19 Bindings: Wiring an OS X Application 295
20 A Custom View for OS X 323
21 Localization 337
22 Bundles and Packages 365
23 Frameworks 381
24 Property Lists 395

IV Xcode Tasks 409


25 Documentation in Xcode 411
26 The Xcode Build System 431
27 Instruments 459
28 Debugging 485
29 Continuous Integration 499
30 Snippets 511

V Appendixes 525
A Some Build Variables 527
B Resources 539

Index 555
Contents
Acknowledgments xxiii
About the Author xxv

Introduction 1
How This Book Is Organized 1
First Steps 2
The Life Cycle of an iOS Application 2
Xcode for Mac OS X 3
Xcode Tasks 4
Appendixes 4
About Versions 4
About the Code 4
Conventions 5

I First Steps 7

1 Getting Xcode 9
Before You Begin 9
Installing Xcode 10
Command-Line Tools 11
Removing Xcode 11
Apple Developer Programs 12
Downloading Xcode 13
Additional Downloads 14
Summary 15

2 Kicking the Tires 17


Starting Xcode 17
Hello World 18
A New Project 18
Quieting Xcode Down 21
Building and Running 22
The Real Thing 24
Getting Rid of It 24
Summary 24
x Contents

3 Simple Workflow and Passive Debugging 25


Creating the Project 25
Building 29
Running 31
Simple Debugging 32
Summary 34

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

5 Compilation 45
Compiling 45
Linking 50
Dynamic Loading 52
Xcode and Clang 53
Local Analysis 54
Cross-Function Analysis 56
Indexing 57
Compiler Products 58
Intermediate Products 58
Precompilation 60
Summary 62

6 Adding a Library Target 63


Adding a Target 63
Targets 64
Target Membership 65
Adding Files to a Target 65
Headers in Targets 68
Contents xi

A Dependent Target 68
Adding a Library 69
Debugging a Dependent Target 70
Summary 70

7 Version Control 73
Taking Control 74
Creating a Git Repository by Hand 74
The State of Your Files 76
How Xcode Works with Git 77
Your First Commit 78
Working with Remote Repositories 79
Cloning an Existing Repository 79
Creating a Repository with Xcode Server 79
Adding a Reference to a Repository 80
Setting Up a “Remote”—Locally 80
Pushing to the Remote 83
Merges and Conflicts 83
User A 84
User B 87
Back to User A 90
The Version Editor 93
Comparison 93
Blame 95
Log 95
Branching 96
Summary 98

II The Life Cycle of an iOS Application 101

8 Starting an iOS Application 103


Planning the App 103
Model-View-Controller 103
The Model 104
The Views 104
The Controllers 106
Starting a New iOS Project 106
Target Editor 107
xii Contents

What’s in the Project 108


One More Thing 110
Summary 112

9 An iOS Application: Model 113


Implementing the Model 113
Entities 114
Attributes 114
Relationships 117
Managed-Object Classes 120
Creating the Classes—the Wrong Way 120
Why Doing It Xcode’s Way Is a Mistake 122
The Right Way—mogenerator 123
Extending the Classes 124
Some Test Data 126
Source Control and Product Files 128
Making the Model Easier to Debug 131
Summary 132

10 An iOS Application: Controller 133


Renaming Symbols 133
Refactoring a Method Name 134
Refactoring a Class Name 134
Editing the View Controller 136
The Table View 136
Setting Up the Passer List 137
Creating a New Passer 138
Live Issues and Fix-it 138
The Real Passer Rating 140
Another Bug 140
Running Passer Rating 144
Summary 145

11 Building a New View 147


The Next View Controller 147
If You Want to Add a View Controller 147
Storyboards, Scenes, and Segues 148
Building a View 152
Outlets and Assistants, in Passing 153
Contents xiii

The Billboard View 154


Autolayout for the Nonce 157
Lots of Labels 158
The Table View 161
Outlets 161
Hooking Up the Outlets 164
Checking Connections 165
Connecting PRGameListController 165
Code Completion and Snippets 168
Testing the Billboard View 170
Summary 171

12 Autolayout in a New View 173


Why Autolayout? 173
Limitations of Autosizing 173
Autolayout 174
The Thing to Remember 174
The Player Billboard, Revisited 175
Why You Should Do More 175
Constraints for Real 176
The Label System 179
Summary 185

13 Adding Table Cells 187


The Game Table 187
Outlets in the Table View 187
Adding Required Protocol Methods 188
Adding Model-to-View Support 189
A Prototype Cell 190
The Game Table: First Run 191
A Custom Table Cell 193
Adding Some Graphics 196
A Cell with an Image in It 196
Hooking the Image View to the Images 197
The Assets Catalog 198
Adding Images to the Assets Catalog 199
Icons and Launch Images 201
Summary 202
xiv Contents

14 Adding an Editor 205


The Plan 205
Adding a Modal Scene 205
An Embedded View Controller 206
Linking the Editor to the Passer List 208
Static Table Cells 209
The Editor View Controllers 210
The Editor Table 210
Passing the Data to the Editor 213
Getting the Data Back 215
Segues 218
Summary 219

15 Unit Testing 221


The Test Navigator 222
Testing the CSV Reader 224
The CSV Test Code 224
Test Data 226
Running the Tests 227
Testing and the Debugger 229
Application Tests 232
TestKit Assertions 233
Simple Tests 234
Equality 234
Exceptions 235
Summary 236

16 Measurement and Analysis 237


Speed 237
The Debug Navigator 238
Instruments 240
Optimization: First Try 243
Optimization: Second Try 245
Optimization: Third Try 246
Memory 247
Allocations: First Look 248
Contents xv

Focusing on One Object Type 250


Cleaning Up the Transients 252
Summary 253

17 Provisioning 255
Apple Developer Programs 255
Organizations 256
Individuals 256
The Enterprise Program 256
Provisioning for iOS 257
What You’ll See 258
Registering Your App 258
Protecting Your Assets 261
Submitting an iOS Application 261
The Capabilities Editor 262
Capabilities for Both iOS and OS X 262
iOS Capabilities 263
OS X Capabilities 263
OS X Sandboxing 264
Why Sandbox? 265
Why Not Sandbox? 266
Gatekeeper and Developer ID 266
Getting a Developer ID 266
Using Developer ID 267
Limitations 269
Distribution Builds 269
Basic Build Settings 269
Adjusting the Build Settings 270
The Build 272
Summary 273

III Xcode for Mac OS X 275

18 Starting an OS X Application 277


The Goal 277
Getting Started 278
Model 281
xvi Contents

Porting from iOS 282


Adding an Entity 282
Wiring a Menu 287
Target/Action 288
First Responder 289
Loading Data into MPRDocument 289
Summary 293

19 Bindings: Wiring an OS X Application 295


Laying Out the Document Window 295
A Table View 296
Autoresizing 299
Filling the Table—Bindings 301
Object Controllers 302
Binding the Team Table 305
Running Bindings 305
Layering NSControllers 307
The Passer and Game Array Controllers 309
How Object Controllers Chain 310
Binding the Passer Table 311
Data Formatters—Numbers 313
Data Formatters—Strings and Dates 314
Running a Popover with Bindings 315
Another Excursion into Autolayout 318
Running the Near-Final App 321
Summary 322

20 A Custom View for OS X 323


A Graphing View 325
Back to the View Controller 328
Using MPRPasserGraphController 330
QuickLook in the Debugger 332
Custom View Properties 334
Summary 336

21 Localization 337
How Localization Works 337
Adding a Localization 338
Contents xvii

Base Localization 338


Localizing for French 339
Trying It Out 345
Localizing MainMenu.xib 347
Bringing a File into Localization 352
Localizing Info.plist 353
Strings in Code 355
Showing Mac Passer Rating in Finder 359
Adding the Icons 359
Summary 364

22 Bundles and Packages 365


A Simple Package: RTFD 365
Bundles 367
Application Bundles 367
The Info.plist File 369
Localizing Info.plist 370
Info.plist Keys for Applications 371
Keys for Both iOS and OS X 371
Keys for OS X 373
Keys for iOS 376
Info.plist 379
Summary 379

23 Frameworks 381
Adding a Framework Target 381
Populating the Framework 382
Using the Framework 383
Installing a Framework 383
Running the Application Alone 383
Where Frameworks Go 385
Putting the Framework in the Application 386
Building Mac Passer Rating 387
One More Thing 388
Debugging a Framework 388
The Debugger and External Targets 389
Postmortem on Postmortem Debugging 393
Summary 394
xviii Contents

24 Property Lists 395


Property List Data Types 395
Editing Property Lists 396
The Property List Editor 399
Why Not the Property List Editor? 404
Other Formats 406
Text Property Lists 406
Binary Property Lists 407
Specialized Property Lists 407
Summary 408

IV Xcode Tasks 409

25 Documentation in Xcode 411


Quick Help 411
Inspector 411
Popover 412
Open Quickly 413
Help 414
The Documentation Window 415
The Navigator Sidebar 415
The Table of Contents Sidebar 415
Class Info 416
Searching and Navigation 417
Keeping Current 419
Your Own Quick Help 421
How to Generate Quick Help 421
Documentation Comment Syntax 422
Your Own Docsets 424
Preparation 425
Configuring Doxygen: Basic Settings 425
Configuring Doxygen: Expert Settings 427
Running Doxygen 428
Installing a Docset 429
Summary 430
Contents xix

26 The Xcode Build System 431


How Xcode Structures a Build 431
Build Variables 434
Settings Hierarchy 435
Levels 436
Editing Build Variables 437
Configurations 438
Adjusting Configurations 438
Configuration Files 439
Creating a Configuration File 439
SDK- and Architecture-Specific Settings 441
Preprocessing xcconfig Files 442
Command-Line Tools 443
xcodebuild 444
xcode-select 445
xcrun 446
Custom Build Rules 446
The Build Log 448
A Simple Build Transcript 450
Summary 458

27 Instruments 459
What Instruments Is 459
Running Instruments 460
The Trace Document Window 461
The Library 467
Instrument Configuration 468
Recording 470
Saving and Reopening 472
The Instruments 474
Behavior 474
Core Data 474
Dispatch 474
Filesystem 475
Garbage Collection 475
Graphics 475
Input/Output 475
xx Contents

Master Track 476


Memory 476
System 477
System—iOS Energy Instruments 478
Threads/Locks 479
Trace 479
UI Automation 480
User Interface 480
Custom Instruments 480
The Templates 482
All Platforms 482
iOS Only 483
Mac Only 483
Summary 484

28 Debugging 485
Scheme Options 485
Info 485
Arguments 486
Options 486
Diagnostics 488
Doing More with Breakpoints 488
The lldb Command Line 491
Tips 493
Summary 497

29 Continuous Integration 499


Xcode Server 500
Repositories 501
Settings 503
Turn It On 503
Bots 503
Creating a Bot in Xcode 503
Create a Bot on the Web 505
Running a Bot 506
Seeing the Results 507
Contents xxi

Building for Distribution 508


Summary 509

30 Snippets 511
Tricks 511
General 511
Code-Folding Ribbon 515
The Assistant Editor 515
Instruments and Debugging 518
Building 518
Workspaces 520
Traps 522

V Appendixes 525

A Some Build Variables 527


Useful Build Variables 528
Environment 528
Code Signing 529
Locations 530
Source Locations 530
Destination Locations 530
Bundle Locations 532
Compiler Settings 533
Search Paths 535
Info.plist 535
The DEVELOPER Variables 536
Source Trees 537

B Resources 539
Books 539
On the Net 540
Forums 540
Mailing Lists 541
Developer Technical Support 542
Sites and Blogs 542
Face to Face 544
Meetings 544
Classes 544
xxii Contents

Other Software 544


Text Editors 545
Helpers 546
Package Managers 548
Version Control 549
AppCode 550
Alternatives to Cocoa 551
Alternatives to Objective-C 553

Index 555
Acknowledgments

O nly part of the effort that went into putting Xcode 5 Start to Finish into your hands
was spent at a text editor. I am indebted to those without whom this book could not
have been made. Many of them appear in the formal production credits; they deserve
better-than-formal thanks.
Trina MacDonald guided me through the from-scratch planning process that a new
Xcode book required, and advocated for it when the need was not obvious.
Olivia Basegio made sure the contracts, correspondence, (and advance payments!) all
got through. She herded the reviewers through their work while the book was still pieces
lying on the ground.
The reviewers—Duncan Champney, Chuck Ross, and Dan Wood—were friends to
the book even through the burden of trying to make sense of a work that spiraled, rather
than marched, to its conclusion. They saved me much embarrassment, and made this a
much better work than it started. Errors remain. Some are intentional, some not; they are
all my own.
Julie Nahil, the production manager, and Stephanie Geels, the copy editor, made it
exceptionally easy to give you a book that is as close as it can be to what I meant it to be.
The process was never smoother.
A full-time day job is not an author’s best friend (except for the part about paying the
rent), but Emerging Technologies, in the IT Services department of The University of
Chicago, was a friend to me. My boss, Alan Takaoka, got me three-day weekends while
I wrote, even when I ran over by a couple of weeks. I promised to keep all my Monday
meetings and deadlines while I worked on the book, but my colleague, Cornelia Bailey,
made the deadlines on our projects disappear.
Bess and Kate bore more than daughters should of my doubts and frustrations, and were
simply confident that I would do fine—which was all they needed to do.
This page intentionally left blank
About the Author

Fritz Anderson has been writing software, books, and articles for Apple platforms since
1984. He has worked for research and development firms, consulting practices, and
freelance. He was admitted to the Indiana bar, but thought better of it. He is now a senior
iOS developer for the Emerging Technologies and Communications division at The
University of Chicago. He has two daughters.
This page intentionally left blank
Introduction

W elcome to Xcode 5 Start to Finish! This book will show you how to use Apple’s
integrated development environment to make great products with the least effort.
Xcode 5 is the descendant of a family of development tools dating back 20 years to
NeXT’s ProjectBuilder. It started as a text editor, a user-interface designer, and a front
end for Unix development tools. It has become a sophisticated system for building
applications and system software, with a multitude of features that leverage a compre-
hensive indexing system and subtle incremental parser to help you assemble the right code
for your project, and get it right the first time.
That much power can be intimidating. My aim in Xcode 5 Start to Finish is to demystify
Xcode, giving you a gradual tour through examples that show you how it is used day to
day. Don’t let the gentle approach fool you: This book will lead you through the full,
best-practices workflow of development with Xcode 5. There are no “advanced topics”
here—I’ll show you version control and unit testing in their proper places in the
development process.

How This Book Is Organized


First, a word on my overall plan for Xcode 5 Start to Finish. This is a book about developer
tools. If it teaches you something about how to use the Cocoa frameworks, or something
about programming, that’s fine, but that’s incidental to showing you the Xcode workflow.
There are many excellent books and other resources for learning the frameworks; you’ll
find many of them listed in Appendix B, “Resources.”
Every tour needs a pathway, and every lesson needs a story. The first three parts of this
book demonstrate Xcode through three applications—a command-line tool, an iOS app,
and an OS X application—that calculate and display some statistics in American football.
None of the apps are very useful; the graphical apps run almost entirely on sample data.
But they demand enough of the development tools to give you a solid insight into how to
use them.
The full code for the example programs is available online from informit.com/
9780321967206 (register your book to gain access to the code). In the interest of space,
I’ll be showing only excerpts.
Xcode supports some technologies, like Core Data and OS X bindings, that are not
for beginners. Xcode 5 Start to Finish dives straight into those techniques, ignoring
conceptually simpler approaches, so I can demonstrate how Xcode works. Other
“advanced” techniques, like unit testing and version control, appear at the points where
best practices require them. Again, I’ll be showing you the workflow as Xcode supports it.
2 Introduction

I’m using applications for iOS and OS X as examples, but read both Parts II and III,
even if you’re only interested in one platform. The applications are only stories; the
techniques apply to both platforms.

First Steps
In Part I, I’ll take you from installing Xcode and running your first project through basic
debugging skills. You’ll work through a small command-line application. The application
may be simple, but you’ll learn foundational skills you’ll need before adding the
complexity of graphical apps.
m Chapter 1, Getting Xcode—Some things to consider before you download
Xcode 5; two ways to download and install it.
m Chapter 2, Kicking the Tires—Your first look at Xcode, setting up a trivial
project and running it.
m Chapter 3, Simple Workflow and Passive Debugging—Write, build, and run
a simple application, and respond to a crash.
m Chapter 4, Active Debugging—Take charge of debugging by setting breakpoints
and tracing through the program. I’ll show you how to organize your workspace.
m Chapter 5, Compilation—A pause for a description of the process of building an
application.
m Chapter 6, Adding a Library Target—Add a library target to a project, and
learn how to build a product from multiple targets.
m Chapter 7, Version Control—Why source control is important, and how to take
advantage of Xcode’s built-in support for versioning through Git and Subversion.

The Life Cycle of an iOS Application


Part II tells the story of a small iPhone app, and how to use Apple’s developer tools to
build it. It introduces you to the graphical editor for user interfaces, and shows how to
profile an app to optimize its speed and memory burden.
m Chapter 8, Starting an iOS Application—You’ll start by creating an iOS

project, and learn the Model-View-Controller design at the core of Cocoa on iOS
and OS X alike.
m Chapter 9, An iOS Application: Model—Design a Core Data schema and

supplement it with your own code.


m Chapter 10, An iOS Application: Controller—Create a controller to link your

model to the on-screen views. On the way, I’ll tell you about refactoring, and
Xcode’s continual error-checking.
m Chapter 11, Building a New View—Design the user-interface views for your

app with the integrated Interface Builder, and take advantage of source-code
completion.
How This Book Is Organized 3

m Chapter 12, Autolayout in a New View—In Xcode 5, autolayout is more about


getting things done than fighting the tools. Learn how to make Cocoa layout do
what you want.
m Chapter 13, Adding Table Cells—While adding an in-screen component to your
app, you’ll debug memory management, and control how Xcode builds, runs, and
tests your apps through the Scheme editor.
m Chapter 14, Adding an Editor—Add an editor view, and get deep into
Storyboard.
m Chapter 15, Unit Testing—Unit testing speeds development and makes your
apps more reliable. I’ll show you how Xcode supports it as a first-class part of the
development process.
m Chapter 16, Measurement and Analysis—Use Instruments to track down
performance and memory bugs.
m Chapter 17, Provisioning—Behind the scenes, the process of getting Apple’s
permission to put apps on devices is complicated and temperamental. I’ll show you
how Xcode saves you from most of the pain, and give you a few tips on how to get
out if it backs you into a corner.

Xcode for Mac OS X


Part III shifts focus to OS X development. Some concepts are more important to OS X
than iOS, but you’ll be learning techniques you can use regardless of your platform.
m Chapter 18, Starting an OS X Application—Carrying iOS components over to
OS X; what the responder chain is, and how Interface Builder makes it easy to take
advantage of it.
m Chapter 19, Bindings: Wiring an OS X Application—As you build a popover
window, you’ll use OS X bindings to simplify the link between your data and the
screen. You’ll also encounter autosizing, a legacy technique for laying out view
hierarchies.
m Chapter 20, A Custom View for OS X—Add a custom view to your app, and
see how Interface Builder can lay it out and configure it, even though it’s not a
standard Cocoa component.
m Chapter 21, Localization—How you can translate your Mac and iOS apps into
other languages.
m Chapter 22, Bundles and Packages—You’ll master the fundamental structure of
most Mac and iOS products, and how both platforms use the Info.plist file to
fit apps into the operating system.
m Chapter 23, Frameworks—Package and share a complete subprogram you can
incorporate into any OS X application.
m Chapter 24, Property Lists—Learn the basic JSON-like file type for storing data
in both OS X and iOS.
4 Introduction

Xcode Tasks
By this point in the book, you’ll have a foundation for digging into the details of the
Xcode toolset. Part IV moves on to topics that deserve a more concentrated treatment
than Parts II and III.
m Chapter 25, Documentation in Xcode—How Xcode gives you both immediate
help on API, and browsable details on the concepts of Cocoa development. Find out
how you can add your own documentation to the system.
m Chapter 26, The Xcode Build System—I’ll show you the fundamental rules and
tools behind how Xcode goes from source files to executable products.
m Chapter 27, Instruments—Using Apple’s timeline profiler, you can go beyond
basic performance and memory diagnostics to a comprehensive look at how your
program uses its resources.
m Chapter 28, Debugging—How to use breakpoint actions and conditions to
eliminate in-code diagnostics. You’ll also find a tutorial on the lldb debugger
command set, for even closer control over your code.
m Chapter 29, Continuous Integration—Mavericks Server complements Xcode 5
with a sleek continuous-integration system that can synthesize your code analysis,
perform cross-platform unit tests, and generate product archives. I’ll show you how
to get started, and how to put it to best use.
m Chapter 30, Snippets—A roundup of tips, traps, and features to help you get the
most from the developer tools.

Appendixes
The appendixes in Part V contain references to help you master the build system, and find
help and support.
m Appendix A, Some Build Variables—The most important configuration and
environment variables from Xcode’s build system.
m Appendix B, Resources—A compendium of books, tools, and Internet resources
to support your development efforts.

About Versions
This book was finished in the fall of 2013, shortly after Apple released iOS 7, OS X
Mavericks, and Xcode 5 to the public. Xcode 5 Start to Finish is written to the first-bugfix
versions of all three.

About the Code


Xcode 5 Start to Finish has many examples of executable code—it’s about a system for
creating code and running it. My goal is to teach workflow. What the code itself does is
Conventions 5

practically incidental. In particular, be aware: Much of the code in this book will not
run as initially presented. Xcode 5 Start to Finish is about the development process, most
of which (it seems) entails prosecuting and fixing bugs. You can’t learn the workflow
unless you learn how to respond to bugs.
So I’ll be giving you buggy code. You may find it painful to read, and if you try to run
it, it will be painful to run. Trust me: It’s for a reason.
Also, sample code for this book is available at informit.com/title/
9780321967206 (register your book to gain access to the code). You’ll find archives of
the projects in this book as they stand at the end of each chapter. With very few
exceptions—I’ll make them very clear—if you want the project as it stands at the start of a
chapter, you should use the archive for the end of the previous chapter.
The chapter archives do not include version-control metadata. If you are following
along with the examples, and using Git (or Subversion) for your work, copy the changes
into your own working directory. If you replace your directory with a sample directory,
you’ll lose your version history.

Conventions
This book observes a number of typographic and verbal conventions.
m Human-interface elements, such as menu items and button labels, are shown like

this.
m File names and programming constructs are shown like this. This will

sometimes get tricky as when I refer to the product of the “Hello World” project
(plain text, because it’s just a noun) as the file Hello World.
m Text that you type in will be shown like this.
m When I introduce a new term, I’ll call it out like this.
I’ll have you do some command-line work in the Terminal. Some of the content will
be wider than this page, so I’ll follow the convention of breaking input lines with
backslashes (\) at the ends. I’ll break long output lines simply by splitting them, and
indenting the continuations. When that output includes long file paths, I’ll replace
components with ellipses (. . . ), leaving the significant parts.
For many, many years the Macintosh had a one-button mouse. (Don’t laugh—most
purchasers didn’t know what a mouse was; try pushing the wrong button on an old Mac
mouse.) Now it has four ways to effect an alternate mouse click: You can use the right
button on an actual mouse; you can hold down the Control key and make an ordinary
click; you can hold down two fingers while clicking on a multi-touch trackpad
(increasingly common even on desktop Macs); or you can tap at a designated corner of a
multi-touch trackpad. And there are more variations available through System Preferences.
Unless the distinction really matters, I’m simply going to call it a “right-click” and let you
sort it out for yourself.
This page intentionally left blank
2
Kicking the Tires

Now you have Xcode. It’s time to start it up and see what it looks like.
Starting Xcode
You’ll find Xcode in the /Applications directory, just like any application. You’ll be
using it constantly, so you’ll want to keep it in the Dock at the bottom of your main
screen. Drag Xcode to the Dock—take care to drop it between icons, and not on one.
Now click on the Xcode icon. It bounces to show Xcode is being launched. The first
time you run any of Apple’s developer tools—even through the command line—you’ll be
asked to read and accept a license agreement for the tools and SDKs. It’s no different from
any other click-through license process.
Next, Xcode will ask you for permission to install “additional components” it needs.
Permit it, and present an administrator’s credentials. Those components overlap the iTunes
frameworks, so you may be asked to close iTunes.
Once the progress window clears, you are greeted with the “Welcome to Xcode”
window (see Figure 2.1).
If this is the first time you’ve ever run Xcode, the table on the right will be empty
(“No Recent Projects”); as you accumulate projects, the table will contain references to
them, so you have a quick way to get back to your work. When you accumulate projects
in this list, you’ll be able to select one, but Xcode doesn’t reveal any way to open it. The
trick is to double-click the item, or press the Return key.
You have three other options:
m Create a new Xcode project. This is obvious enough; it’s how you’d start work
on a new product. You’re about to do this, but hold off for the moment. You could
also select File →New →New Project. . . ( N).
m Check out an existing project. Xcode recognizes that source control manage-
ment is essential to even the most trivial of projects. Your development effort might
start not with your own work, but with collaborative work pulled in from a source
repository. Use this link to get started.
18 Chapter 2 Kicking the Tires

Figure 2.1 When you launch Xcode, it displays a “Welcome” window with options for creating
a new project, reopening a recent one, or fetching a project from a source-control repository.

m Open Other. . . (at the bottom of the “recents” list). This will get you the standard
get-file dialog so you can select any Xcode project file you want. You can do the
same thing with the File →Open. . . ( O) command.
If you need to get back to the Welcome window, select Window →Welcome to
Xcode ( 1). If you’re tired of seeing this window, uncheck Show this window when
Xcode launches.
Note
“Show this window when Xcode launches” is not quite accurate. If you had a project open
when you last quit Xcode, it will reopen automatically when you start it up again, and the
Welcome window won’t appear.

Hello World
Just to get oriented, I’m going to start with the simplest imaginable example project—so
simple, you won’t have to do much coding at all.

A New Project
Click the Create a new Xcode project link. Xcode opens an empty Workspace
window, and drops the New Project assistant sheet in front of it (see Figure 2.2). Select
OS X →Application from the list at left, and then the Command Line Tool template
from the icons that appear at right. Click Next.
The next panel (Figure 2.3) asks for the name of the project and the kind of
command-line tool you want.
Hello World 19

Figure 2.2 The New Project assistant leads you through the creation of an Xcode project.
First, you specify the kind of product you want to produce.

Figure 2.3 The Options panel of the New Project assistant lets you identify the product and
what support it needs from system libraries.
20 Chapter 2 Kicking the Tires

1. Type Hello World in the Product Name field. This will be used as the name of
the project and its principal product.
2. Xcode should have filled the Organization Name in for you, from your “me”
card in the Address Book. If you listed a company for yourself, that’s what will be in
the field; otherwise, it’s your personal name. Xcode will use this as the name of the
copyright holder for all new files.
3. Virtually all executable objects in the OS X and iOS world have unique reverse-
DNS-style identifiers that are used to uniquely identify them. The Company
Identifier is the leading portion of those reverse-DNS names, to be used by every
product of this project. For this example, I used com.wt9t.
4. By default, Xcode infers the unique Bundle Identifier from the company identifier
and the name of the product. You’ll see later how to change this if you have to.
5. The Type popup prompts Xcode on how to fill in the system libraries the tool will
use. This is just a plain old C program, with no need for C++ or Apple-specific
support, so choose C.
Finally, a put-file sheet appears, so you can select a directory to put the project into. For
this example, select your Desktop. One more thing—uncheck the box labeled Create local
git repository for this project. Source control (Chapter 7, “Version Control”) is a
Good Thing, but let’s not deal with it in this trivial example. Click Create.
If you look on your Desktop, you’ll find that Xcode has created a folder named Hello
World. The project name you specified is used in several places.
m It’s the name of the project directory that contains your project files.

m It’s the name of the project document (Hello World.xcodeproj) itself.


m It’s the name of the product—in this case a command-line tool named Hello
World.
m It’s the name of the target that builds the product. I’ll get into the concept of a target
later; for now, think of it as the set of files that go into a product, and a specification
of how it is built.
m It’s the name of the target’s directory inside the project’s directory.
m Suitably modified, it’s the name of the man-file template for the tool
(Hello World.1).
When you’ve made your choices, Xcode unmasks the workspace for the Hello World
project (Figure 2.4). Don’t look at it too closely just yet. Xcode starts you off with a view
of the settings that control how Hello World is to be built. This is useful information,
but for now, it’s just details.
More interesting is the program code itself. The left column of the window is called
the Navigator area. Find main.c in the list, and click it (see Figure 2.5). The Editor area,
which fills most of the window, now displays the contents of main.c. This is the code for
the canonical simplest-possible program, known as “Hello, World.”
The Navigator area displays many different things in the course of development—it’s
not just a file listing. It can display analyses, searches, and build logs. Which list you see
often depends on what Xcode wants to show you; you can make the choice yourself by
Hello World 21

Figure 2.4 Once set up, the Hello World project window fills in with a list of source files and
a display of the options that control how the application will be built.

Figure 2.5 Clicking the name of an editable file in the Project navigator displays its contents in
the Editor area.

clicking the tiny icons in the bar at the top of the Navigator area. Hovering the mouse
pointer over them will show you the names of the various views.
As this book goes on, you’ll meet all of them. For now, you care only about the
“Project” navigator, the file list Xcode starts you out with. Feel free to click the other
icons, but to keep up with this example, be sure to return to the Project navigator, as
shown in Figure 2.5.

Quieting Xcode Down


But first.
Xcode is a toolset that contains everything its creators could think of to provide a
powerful, helpful environment for writing iOS and OS X applications. Often, you barely
need to begin a task, and Xcode will offer to finish it for you. It will usually be right. I use
these features all the time. I recommend them.
22 Chapter 2 Kicking the Tires

You’re going to turn them all off.


Automatic completions and indentations and code decorations and code fixes are great,
once you know what’s going on, but an automaton that snatches your work out of your
hands, however helpfully, is straight out of The Sorcerer’s Apprentice. Better to start with
what you want to do; once you’re confident of what that is, then you have the discretion
and control to direct Xcode as it helps you.
So you’re going to damp Xcode down a bit. You’ll do all of this in Xcode’s Preferences
window, which you can summon with Xcode →Preferences. . . ( comma). The
Preferences window is divided into panels, which you select with the icons at the top of
the window.
To start, make sure the General panel is visible. Under Issues, uncheck Show live
issues.
Next, select the Text Editing panel, which has two tabs. Select the Editing tab, and
uncheck Show: Code folding ribbon, and all the options under Code completion:.
In the Indentation tab, turn off Line wrapping: Wrap lines to editor width and
the Syntax-aware indenting section.
Now Xcode will mostly stay out of your way as you explore.

Building and Running


The program in main.c would run as is, but we have to trick Xcode into keeping its
output on the screen long enough to see it. Add a few lines after the printf call so it
looks like this:
int main(int argc, const char * argv[])
{

// insert code here...


printf("Hello, World!\n");

/******************************************
* Pause, so the console doesn't disappear
******************************************/
char dummy[128];
fgets(dummy, sizeof(dummy), stdin);

return 0;
}

Now we can run it. Select Product →Run ( R).


In the ordinary course, Xcode would then build and run Hello World. However, if
this is the first time you’ve run any application, there is a security problem: Running an
app from Xcode puts it under the observation of a debugger, which will have access to the
internal data and running state of the app. Crossing process boundaries like that is tech-
nically a security breach, and you have to authorize it.
Hello World 23

Xcode posts an alert, Enable Developer Mode on this Mac?. It explains that you
could be asked for an administrator’s password every time you run the debugger
(“Developer Tools Access needs to take control of another process. . . ”), or, with
Developer Mode, you could do the authorization once and forget about it. Click Enable,
enter an administrator’s credentials, and carry on.
Note
You can turn Developer Mode off, or on again, from the Devices organizer ( 2). Select
your Mac and click the button Disable Developer Mode.

With authorization taken care of, a heads-up window (“bezel”) appears almost instantly,
to tell you “Build Succeeded.” (If Xcode is in the background, a notification banner will
appear saying the build succeeded, and identifying the project and product involved.)
So. What happened?
Hello World is a console application; it just writes out some text without putting up
any windows. Xcode captures the console of the apps it runs in the Debug area, which
popped into view when you ran the program (Figure 2.6). The Debug area includes a
console view on the right. It says Hello, World! (Figure 2.7).
Click in the console to make it ready for text input, and press the Return key. Hello
World exits, and the Debug area closes.

Figure 2.6 The View selector in the toolbar shows and hides the Navigator, Debug, and Utility
areas (left to right) of the project window. Clicking a button so it is highlighted exposes the
corresponding area. Here, the Navigator and Debug areas are selected.

Figure 2.7 Opening the Debug area after running Hello World shows the eponymous output.
24 Chapter 2 Kicking the Tires

Note
If the Debug area didn’t hide itself as soon as an application terminated, we wouldn’t have
had to add that fgets() call. That’s easy to change; see the “Behaviors” section of
Chapter 4, “Active Debugging.”

The Real Thing


What Xcode just produced for you is a real, executable application, not a simulation. To
prove it, open the Terminal application (you’ll find it at /Applications/Utilities/
Terminal, and you’d be well advised to add Terminal to your Dock). In Xcode, find the
Hello World product in the Project navigator by clicking the disclosure triangle next to
the Products folder icon. Drag the Hello World icon into the Terminal window, switch
to Terminal, and press the Return key. (The path to a file deep in a directory for build
products is remarkably long, but Terminal takes care of the necessary escaping.) “Hello,
World!” appears.
If you want access to the executable file itself, select it in the Project navigator, then
File →Show in Finder—also available in the contextual menu you get by right-clicking
the Hello World icon. A window will open in the Finder showing you the file.
You’re done! You can close the Workspace window (File →Close Project, W) or
quit Xcode entirely (Xcode →Quit Xcode, Q).

Getting Rid of It
There is nothing magical about an Xcode project. It’s just a directory on your hard drive.
If you don’t want it any more, close the project, select its enclosing folder in the Finder,
and drag it to the Trash. It’s gone. It won’t even show up in the Recents list in the
Welcome to Xcode window, or in the File →Open Recent menu.
That’s it.
Okay, yes, the build products of the project will still stick around in a warren of direc-
tories inside ˜/Library/Developer/Xcode/DerivedData. They aren’t many or large
in this case, but there’s a principle involved.
If you want them gone, the best way is to close the project window, open the Orga-
nizer window (Window →Organizer, 2), select the Projects panel, select the
“Hello World” project, press Delete, and confirm the deletion in the ensuing alert sheet.
All trace of the build products is gone.

Summary
In this chapter, you had your first look at Xcode, and you discovered that it doesn’t bite.
You saw how to create a simple project, one you didn’t even have to edit. You saw what
happens when you run a project in Xcode, how to close a project and quit Xcode, and at
last how to get rid of the project entirely.
Next, we’ll start doing some real work.
Index

A
.a (static libraries), 63, 519
Accessibility package, 14
Accessory setting
details, 209
editors, 191
Accounts panel
Apple ID, 256
bots, 504
Developer ID, 266
iOS provisioning, 258–259, 261
remote repositories, 82, 84
version control, 74
Actions
for wiring menus, 288, 291
xcodebuild, 444
Activate/Deactivate Breakpoints, 39
Active Allocation Distribution style, 469
Activity Monitor instrument, 477
actool compiler, 456
Ad hoc (beta) distributions, 257, 262,
270–272
AD HOC CODE SIGNING ALLOWED, 529
Add, 33
Add an Account, 259
Add Apple ID, 256, 258
Add Breakpoint at Current Line, 36
Add Build Rule, 446–447
Add Constraints, 161, 178–179, 182, 184
556 Index

Add Copy Files Build Phase, 386 All Issues, 449


Add Entity, 114 All Messages, 449
Add Exception Breakpoint, 141, 307 All Objects Created, 250
Add Files to All Processes, 462
availability, 282 Allocation Density style, 469
get-file sheets, 110, 124, 227 Allocation Lifespan settings, 250–251
mogenerated directory, 284 Allocation of memory, 248–250

projects, 432, 520 Allocations & Leaks service, 471

target pickers, 67 Allocations instruments, 469, 476, 518

Add Item, 400–401 Allocations list, 252


Allow Location Simulation, 487
Add Localization, 339
alltargets, 444
Add Missing Constraints in Container, 160
Always use deferred mode, 471
Add Missing Constraints in Game List
Controller, 157 Analysis and measurement, 237

Add Other, 65 memory, 247–253


Add Relationship, 117 speed. See Speed
Analysis message display, 56
Add Remote, 80, 82
analyze action for xcodebuild, 444
Add/Remove Breakpoint at Current Line, 495
Antecedents in makefile goals, 431
Add Run Script Build Phase, 127
Antialiasing, 378
Add shortcut, 471
.app directory, 367
Add Target, 63, 222, 381
App Store
Add to targets table, 111
archives for, 508
Add User-Defined Setting, 527
Enterprise program, 256, 270–271
Added file state, 77
installer packages, 387
Adobe PhoneGap, 551
OS X applications, 264, 279
Advanced attributes for models, 116
program members, 259
Agent applications, 375
provisioning, 255, 257
Alert sheets sandboxing, 264–266
in debugging, 33 Xcode downloads, 10–13
version control, 90 Xcode Server, 500
Alerts in localizations, 357–358 Xcode updates, 445
Alignment .app suffix, 445
labels, 159, 181–182 Appcelerator Titanium, 551–552
text-cell objects, 309 AppIcon image set, 201
All in builds, 435, 449 AppKiDo tool, 546
All Entities, 427 Apple Developer Forums, 541
All Frames in Container, 178 Apple developer programs, 12–13, 255–256
Index 557

Application Data popup, 487 caller display, 58


Application icon, 359 connection checks, 165
Application IDs, 257 Editor area, 153
Applications Interface Builder, 150
bundles, 367–369 jump bar, 155–156, 315
iOS. See iOS localizations, 347
Info plist keys for, 371–373 Option-key navigation, 413
registering, 258–260 overview, 515–517
tests, 232–233 Preview, 156–157
/Applications directory, 10, 17 views, 153, 162, 164
apropos in lldb, 491 Associative arrays, 396, 407
ARC (Automatic Reference Counting), 193 At sign (@) notation, 490
arch in clang, 452 atIndexPath method, 137
Architecture-specific build settings, 441–442 ATSApplicationFontsPath key, 374
archive action in xcodebuild, 444 Attach to Process, 388, 463
Archives organizer, 267, 273, 387 att Color setting, 334–335
ARCHS, 533 Attributes for models, 114–117
ARCHS STANDARD, 438, 533 Audio package, 14
Arguments Passed On Launch table, 307 @author keyword, 423
Arguments tab Authorization in iOS provisioning, 257
binding debugging, 307 Authorized devices in iOS provisioning, 257
localizations, 346 Autolayout, 173
schemes, 486 labels, 160, 179–185
ARM processors, 53 localizations, 341–342
Assembly listings, 59–60 overview, 174
assert macro, 511 purpose, 173–174
Assertions size constraints, 175–179
description, 221 Automatic code completion, 22, 28, 168–170
TestKit, 233–235 Automatic for Assistant editor, 153
Asset catalog, 456 Automatic Reference Counting (ARC), 193
Assets, protecting, 261 Automatic Snapshotting, 477
Assets catalog, 198 Automation instrument, 480
adding images to, 199–201 Autorelease pools, 252–253
image sets, 198–199 Autoresize
Assignments (=) in Boolean contexts, 140 document window, 299–301
Assistant editor limitations, 173–174
assembly display, 59 localizations, 341
558 Index

Auxiliary tools, 14 Bots, 503


awakeFromNib, 334 creating, 503–506
results, 507–508
running, 506
B Branching in version control systems, 96–98
@b debug format, 423 breakpoint in lldb, 492
B2B program, 256 Breakpoint navigator, 141
Badges for test navigator, 222 breakpoint set, 496
Bar graphs, 32 Breakpoints, 35

CPU and memory, 291 bindings, 307


Debug navigator, 191–192 listing, 141
Base localization, 337–339
removing, 36
setting, 36–37
Basic button, 435
tips, 493
BBEdit text editor, 349, 545
unit testing, 229
Beta (ad hoc) distributions, 257, 262,
270–272 working with, 488–491
Billboard view Browse All Versions, 305
@bug keyword, 423
label constraints, 179–185
build action in xcodebuild, 444
size constraints, 175–179
Build Configuration popup, 438
testing, 170–171
Build for popup, 323
view, 154–158
Build For Running, 448
Binaries, fat, 454
Build New Instrument, 482
Binary property lists, 407
Build Phases tab
Bindings, 295
description, 64
data formatters, 313–315
extending classes, 127
filling, 301–307
frameworks, 382–383, 386
NSController layering, 307–315 iOS projects, 110
object controllers, 302–304, 310–311 Link Binaries with Libraries, 69, 110
popovers, 315–320 targets, 50, 65–66, 432–433
running, 305–307 Build Rules tab, 64, 446–447
Blame view in Comparison editor, 93, 95 Build settings, 434–435, 527–528
Block Graph style, 469 code signing, 529–530
Blogs, 542–543 Compiler, 533–535
Bluetooth instrument, 478 DEVELOPER, 536–537
Bookmark navigator, 415 environment, 528–529
Books, 539–540 Info.plist, 535–536
Borders for buttons, 206 locations, 530–532
Index 559

search paths, 535 Bundles, 365, 367


source trees, 537 application, 367–369
Build Settings tab Info.plist keys and file, 369–373, 379
build settings, 434–438, 527–528 location settings, 532
code size, 511 .strings files, 356
configuration files, 441 targets, 523
flags, 534 Button borders, 206
frameworks, 386–387, 393
garbage collection, 534
C
hierarchy, 435–436
packages, 370 .c files, 434
product names, 279 @c keyword, 423
Quick Help, 412, 422 C++ language, 554
release size, 511 Call-tree constraints, 466
SDK, 108 Call Tree listing, 241
targets, 64, 272 Cancel Integration, 508
Building views, 152 Canvas
labels, 158–160 displaying, 177
outlets and Assistant editors, 153–154 labels, 181, 183
Builds and build system, 431 segues on, 218
command-line tools, 443–446 view controllers, 149–150
configuration files, 439–443 Canvas menu, 160, 176
configurations, 438–439 Capabilities editor, 262–263
custom rules, 446–448 Capabilities tab, 264
distribution, 269–273, 508–509 Carbon Events instrument, 480
logs, 448–449 Cartesian coordinates for views, 324
projects, 22–24, 29–31 Cascade delete rule, 118
settings, 434–435, 437–438 CC, 434
settings hierarchy, 435–437 Cell Based, 296
structures, 431–434 cellForRowAtIndexPath method
transcript, 450–458 custom cells, 194–196
tricks, 518–520 images, 197–198, 299
BUILT PRODUCTS DIR, 531 outlets, 188
Bumgarner, Bill, 518 prototype cells, 190–191
Bundle Identifier setting table view, 137
new projects, 20 Cells. See Tables and table cells
OS X applications, 279 Centering constraint, 183
560 Index

Certificates Close Project, 24


code signing, 529 cocoa-dev list, 542
Developer ID, 12, 266–268 Cocoa Events instrument, 480
distribution builds, 269–270, 508–509 Cocoa language application frameworks
iOS provisioning, 257, 261 alternatives, 551–552
private keys, 261 Core Data, 107
team membership, 258–260 libraries, 69
Certificates, Identifiers & Profiles site, 258 pointers, 54
Change color, 427 Cocoa Touch framework, 103, 168
Check and Install Now, 421 CocoaHeads meetings, 544
Check for and install updates automatically, CocoaPods package manager, 549
421 Code completion, 22, 28, 168–170
Check out an existing project, 17, 74, 79, 83 Code completion: Automatically insert
Check Out, 83 closing “{”, 28
Choose Target, 463 Code-folding ribbon, 515–516
clang compiler, 47 Code Signing Identity, 238
builds, 452 Code signing settings, 529–530
cross-function analysis, 56–57 Code snippets, 169–170
indexing, 57–58 Color
local analysis, 54–56 labels, 159
modules, 60–62 tables, 308
overview, 53–54 views, 155, 334–335
precompilation, 60 Color controls
Class Info settings, 416–417 palette, 155
Class Prefix, 107 picker, 308
Classes (educational), 544 well, 155
Classes (objects) Column Sizing setting, 297
document localizations, 360 Combined for build settings, 435
extending, 124–126, 162, 189 Combo fields for property lists, 408
managed-object. See Managed-object Command Line Developer Tools package, 12
classes Command Line Tool template, 18
name refactoring, 134–136 Command-line tools, 11
object allocations by, 459 arguments, 347
clean action for xcodebuild, 444 builds, 443–446
Cleaning up transients, 252–253 package, 14
Clear Constraints, 177 Comments, 422–424
Cloning repositories, 79 Commit editor, 78–79
Index 561

Commit sheet, 86 Configuration tab for bots, 505


Commits Configure Repository sheet, 79–80
selective, 85–87 configureatIndexPath method, 137
version control systems, 78–79, 92–93 configureView method, 165–168
Company Identifier setting Conflicted file state, 77
iOS, 106 Conflicts
new projects, 20 assignments, 513
OS X, 279 version control systems, 83–93
Compare Call Trees, 245 Connect to a Git Repository, 502

Comparison editor, 93–95 Connect to a Subversion Repository, 502


Connecting outlets, 153–154
Blame view, 95
Connection inspector for First Responders, 289
Log view, 95–96
Connections for outlets, 164–168
compColor property, 335
Connections instrument, 477
Compile for controllers, 138–139
Console applications, 23
Compile Sources build phase, 50, 432–433
Console windows, 494
CompileAssetCatalog phase, 456
Constraints
Compilers and compiling, 45
description, 175–176
build settings, 533–535
labels, 179–185
clang, 53–54
size, 176–179
controllers, 138–140 trace document window, 466
cross-function analysis, 56–57 views, 157, 174–176
dynamic loading, 52–53 Content Set, 310
indexing, 57–58 Contents directory, 367, 369
intermediate products, 58–62 Continue, 39
linking, 50–52 Controller Key setting, 304–305
local analysis, 54–56 Controller layers, 133
precompilation, 60–62 MVC model, 104, 106
process, 45–50 object, 302–304
warnings, 29–30, 518 view. See View controllers
Completes action, 42 Converting
Completion, code, 22, 28, 168–170 data types, 168, 406
componentsSeparatedByCharactersInSet .iconset to .icns, 361–363
method, 229 property list formats, 407
componentsSeparatedByString method, 252 Coordinates for views, 324
Condition field for breakpoints, 490 Copy
Conditionally Sets Editable, 310 configuration files, 441
Configuration files, 439–443 dictionaries, 401
562 Index

Copy Bundle Resources build phase, 129, Credits.rtf file


432, 448 localizations, 341–346
folder references, 513 OS X applications, 280
Info.plist file, 379 Cross-function analysis, 56–57
targets, 66, 68 CSResourcesFileMapped key, 374
Copy items into destination group’s folder .csv data files, 224
(if needed), 111, 282, 520–521 CSV Reader, 224–228
Copy only when installing, 386 CSVFileTests class, 226
Copy Source Changes, 95 Current Bytes style, 469
Copy Transcript for Shown Results, 450 Current Views, 40
Core Animation instrument, 475 Custom build rules, 446–448
Core Data Custom instruments, 480–482
events, 460 Custom script, 447
model objects, 113 Custom segues, 218
Core Data Cache Misses instrument, 474 Custom table cells, 193–196
Core Data Faults instrument, 474 Custom views
Core Data Fetches instrument, 474 Graphing, 325–328
Core Data Saves instrument, 474 overview, 323–325
Counters instrument, 477 properties, 334–336
CPU Activity instrument, 478 view controller, 328–332
CPU bar for speed analysis, 238–239
CPU Monitor instrument, 477–478 D
CPU Usage style, 469
DarwinPorts package manager, 549
Create a new Xcode project, 17, 25
Dash styles tool, 546–547
Create Bot, 504–505
Dashcode package, 14
Create Document-Based Application, 279
Data formatters
Create folder references for any added
numbers, 313–314
folders, 512
strings and dates, 314–315
Create git repository on, 25, 74, 279
Data Model editor, 114
Create groups for any added folders, 111, 282
Data Model inspector, 116–117, 119
Create local git repository for this project, 20
Data Protection, 263
Create New Remote, 79
Data tips, 332–333
Create NSManagedObject Subclass, 120
Data types for property lists, 395–396,
Create Symbolic Breakpoint, 495 406–407
Created & Destroyed, 251 dataSource property, 187
Created & Still Living, 251 Date attribute, 115
Index 563

Date data type Decrease Deck Size, 470


data formatters, 314–315 Deepest Stack Libraries style, 469
property lists, 395–396, 406 Default attribute, 115
Date Style popup, 315 Default - Property List XML, 405
Debug area Deferred Mode, 472
breakpoints, 36 #define directive, 58
components, 23, 31–34 Definitions, 514

exception traces, 305 Delegate design pattern, 136

hiding, 23–24, 40–41 delegate property, 187

variables, 37, 143, 229, 493 Delete Rule for relationships, 118
Deleting
Debug area actions, 42
menus, 287
DEBUG macro, 511
projects, 24
Debug navigator, 32
Deny delete rule, 118
Game table, 191–192
Dependencies
speed analysis, 238–239
implicit, 69–70
stack trace, 141–142
makefile goals, 431
Debug Workflow menu, 518
Dependent targets, 68–70
Debug XPC services used by this application,
Deployment Target field, 108
487
@deprecated keyword, 423
Debugging, 485
DERIVED FILE DIR, 448, 531
bindings, 307
Derived files, 530–531
breakpoints. See Breakpoints
description method, 494
controllers, 140–144
Descriptions
dependent targets, 70
document localizations, 361
frameworks, 388–393
exceptions, 142
lldb command line, 491–493
Destination locations
models, 131 Doxygen, 426
problem fixes, 39–42 settings, 530–532
projects, 32–34 destination for xcodebuild, 445
QuickLook feature, 332–334 Destination popup for frameworks, 386
scheme options, 485–488 Detail area
stepping through code, 37–39 Call Tree listing, 241
tips, 493–497 trace document window, 465–466
tricks, 518 Detail Disclosure, 209
unit testing, 229–232 DEVELOPER APPLICATIONS DIR, 536
variables pane, 37–38 DEVELOPER BIN DIR, 536–537
Debugging-symbol archive, 456 DEVELOPER DIR, 536
564 Index

/Developer directory, 10 Dispatch instruments, 474


DEVELOPER FRAMEWORKS DIR, 537 dispatch once function, 169
Developer ID, 266–269 Display Brightness instrument, 478
Developer ID Application identity, 267 Display Pattern field, 312
Developer ID Installer identity, 267 Display PostScript engine, 324
DEVELOPER LIBRARY DIR, 537 Display requirements, 10
Developer mode, disabling, 23 Distribute for Developer ID, 267–268
Developer programs, 12–13, 255–256 Distributed source-control systems, 79
DEVELOPER SDK DIR, 537 Distribution
Developer Technical Support (DTS), builds, 269–273, 508–509
12, 542 iOS applications, 261–262
DEVELOPER TOOLS DIR, 537 .dmg (disk image) files, 13–14
DEVELOPER USR DIR, 537 Do not show this message again, 34
Development process in iOS applications, Dock, 17
261 DOCSET BUNDLE ID setting, 428
Device Family setting, 107 DOCSET FEEDNAME setting, 428
Devices settings, 260 DOCSET PUBLISHER ID setting, 428
Diagnostics tab, 488 DOCSET PUBLISHER NAME setting, 428
Diagrams panel, 427 Docsets (documentation sets), 419–421,
Diamond badges, 222 424–425
Dictionaries Doxygen settings, 425–428
object properties, 211 installing, 429
property lists, 395–396, 400–401, preparation, 425
407–408 Document Extension setting, 279
Direction popup, 178 Document Outline sidebar, 163
Directories Document Outline view, 150
iOS projects, 111 Document types for localizations, 360–363
localization, 337 Document Versions: Allow debugging when
Directory I/O instrument, 475 using document Versions Browser, 487
Disable Developer Mode, 23, 494 Document window
Discard All Changes, 94, 121 autoresizing, 299–301
Discard Changes, 94 laying out, 295–301
Disclosure triangles in trace document Documentation, 411
window, 464 docsets, 419–421, 424–429
Disk image (.dmg) files, 13–14 Documentation window, 415–419
Disk Monitor instrument, 477 downloading, 10–11
Disk space requirements, 10 Help menu, 414–415
Index 565

Open Quickly, 413–414 E


Quick Help, 411–413, 421–424
@e keyword, 423
Documentation and API Reference settings,
Edges for views, 178, 206
414
Edit Active Target, 463
Documentation sets (docsets), 419–421,
424–425 Edit All in Scope, 57
Doxygen settings, 425–428 Edit Breakpoint, 490–491
installing, 429 Edit Find Options, 84
preparation, 425 Edit Instrument sheet, 481
Documents Edit ‘Reads/Writes’ Instrument, 480
application bundles, 373 Edit Scheme, 70, 346
icons, 361–363 Editing
OS X, 277–278 build settings, 437–438
Dollar sign ($) setting, 512 property lists, 396–406
Dot panel in Doxygen, 428 view controllers, 136–138
dot tool, 425 Editing tab, 22, 28, 168
Downloading Editor area, 32, 153
docsets, 420–421 Editor control, 42, 302
packages, 14–15 Editor menu, adjusting, 512
Xcode, 13–14 Editor Style control, 114
Downloads panel, 11, 15, 421 Editor table, 210–213
Doxygen generator, 421 passing data to, 213–215
basic settings, 425–427 retrieving data from, 215–217
comments, 423–424 Editor view controllers, 210–213
docset installation, 429 Editors, 205
docsets, 424–425 Assistant. See Assistant editor
expert settings, 427–428 Capabilities, 262–263
running, 428–429 Commit, 78–79
Drive & Record, 470 Comparison, 93–96
DSTROOT, 531 Data Model, 114
DTPerformanceSession framework, 473 linking, 208–209
DTrace Data Import, 482 Merge, 91
DTrace tool, 482 Project, 339
DTS (Developer Technical Support), 12, 542 Property List, 370, 399–406
DYLIB INSTALL NAME BASE, 386 RTF, 342
Dynamic libraries (.dylib), 385–386, 519 segues, 218
Dynamic loading, 52–53 static table cells, 209–210
566 Index

Editors (continued ) Exception breakpoints, 141


Target. See Targets and Target editor @exception keyword, 422
text, 545–546 Exceptions, 141–144
Version, 93 assertions, 235
@em keyword, 423 temporary, 265
emacs text editor, 546 EXECUTABLE FOLDER PATH, 532
Email Link, 419 EXECUTABLE PATH, 386, 532
Embedded view controllers, 206–208 existingPassersWithLastName function,
en.lproj directory, 337–338 243–246, 286
Enable Developer Mode on this Mac? Expand Variables Based On popup menu, 486
alert, 23 Expert tab in Doxygen, 425, 427
Enable Developer Mode, 494 Export Accounts, 261
Enable for Development button, 260 Export button in Documentation window, 419
ENABLE NS ASSERTIONS macro, 512 Export Developer ID-signed Application, 267,
Enable Performance Analysis popup, 488 387
@encode directive, 234 Export Items, 261
Energy-impact report, 291–293 Export Snapshot, 89
Energy Usage instrument, 479 Exported UTIs settings, 361
Enterprise developer program expression, 492–493
Apple developer programs, 256 expression interpreter, 492
build settings, 270–271 Extended Detail view
iOS distributions, 262 stack traces, 482
Entities, 113 trace document window, 467
models, 114 Extensions
OS X applications, 282–286 classes, 124–126, 162, 189
Environment settings, 528–529 document localizations, 360–361
Equality assertions, 234–235 extern keyword, 514
Errors
compiler, 29–30
F
debugging. See Debugging
displaying, 54, 56 F-keys, 39
unit testing, 229 Face to face resources, 544
Errors Only, 449 Family popup for labels, 159
Escape key shows code completions, 169 Fat (universal) binaries, 454
Event Profiler instrument, 477 Features, turning off, 21–22
Events, 460, 477 Fetched Properties table, 114
EXC BAD ACCESS message, 32 fetchedResultsController method, 137
Index 567

File Activity instrument, 475 Flatten Recursion, 466


File Attributes instrument, 475 Folders
File inspector tab, 65 new projects, 20
File Locks instrument, 475 references, 512–513
File Types column, 341 Folders: Create groups for any added folders,
Files 124
adding to targets, 65–68 Font field for labels, 159
configuration, 439–443 Fonts & Colors panel, 32
renaming, 514 Format menu, deleting, 287
searching, 514 Format specifiers in localizations, 358
states, 76–77 Formats tab for localizations, 354
File’s Owner setting, 288, 304 Formatters
Filesystem instruments, 475 numbers, 313–314
Fill With Test Data, 291, 316 strings and dates, 314–315
Filled Line Graph style, 469 Forums, 540–541
Filling bindings, 301–307 FOSS (free and open-source) software, 548
fillWithData, 288–291 Foundation command-line program, 54
Filtering stack trace, 142 Fraction Digits setting, 314
Find for property lists, 401, 403 frame in lldb, 492
Find and Replace, 85, 403 Frames for labels, 180–181
Find Implicit Dependencies, 70, 383 Frameworks, 60, 381
Find in Project, 87–88 in applications, 386–387
Find in Workspace/Project, 403 debugging, 388–393
Finder installing, 383–387
bundles, 367 location, 385–386
command-line arguments, 347 populating, 382–383
docset versions, 421 targets, 381–383
instruments, 460 Frameworks directory, 369
iOS apps, 369 FRAMEWORKS FOLDER PATH, 532
localizations, 354 Frameworks groups in iOS projects, 109–110
packages, 366 Free and open-source (FOSS) software, 548
PNG files, 454 free function, 459
Fink package manager, 549 French localization, 338
First Responder, 288–289 base, 338–339
Fix Issue, 107 process, 339–345
Fix-it popover, 139–140 trying out, 345–347
Fix Misplacement, 180 Function keys, 39
568 Index

G Navigator detail, 56
registering apps, 258
Game Array controller bindings, 309–311
GENERATE DOCSET setting, 428
Game Center mediator, 262
Generate Test Data build phase, 129
Game table, 187
Generic apps, 262
data formatters, 314–315
Generic team provisioning profiles, 260
first run, 191–193
genstrings utility, 357–358
Model-to-View support, 189–190
Gestures for navigation, 517
outlets, 187–188 Get-file sheets, 110–111
protocol methods, 188–189 Git version-control system, 25, 550
prototype cells, 190–191 OS X applications, 279
table cells, 193–196 repositories. See Repositories
gameTableClicked action, 316–317 servers, 82
Garbage Collection instrument, 475 Xcode with, 77–78
Gatekeeper, 12, 123, 266–269 .gitignore files, 75
gcc compiler, 54 Global hot key combinations, 471
GCC prefix, 533 Goals for makefiles, 431
GCC ENABLE CPP RTTI, 434 GPS instrument, 478
GCC ENABLE OBJC GC, 534 Grand Central Dispatch facility, 169
GCC PREPROCESSOR DEFINITIONS, Graphics, 196
533–534 assets catalog, 198–201
GCC PREPROCESSOR DEFINITIONS NOT icons and launch images, 201–202
USED IN PRECOMPS, 534
image views, 197–198
GCC TREAT WARNINGS AS ERRORS, 534
table cells, 196–197
GCC VERSION, 533
Graphics instruments, 475
GCC VERSION IDENTIFIER, 533
Graphics package, 14
GCC WARN , 535 Graphing views, 325–328
GCC WARN INHIBIT ALL WARNINGS, 534 Graphs in Debug navigator, 191–192
General editor for iOS projects, 107 GraphViz package, 425
General settings Gray Scale slider, 308
automatic features, 22 Group from Selection, 121, 150
controllers, 139 Group popup, 26
icons, 200, 359 GROUP, 528
images, 200 Grouped style, 209
instruments, 471 Groups
iOS projects, 107 bots, 507
libraries, 69 frameworks, 109–110
Index 569

H HTML and Doxygen, 427–428


HUD (heads-up display) window, 163
Hardware capabilities, 264
Hardware IO package, 14
HEADER SEARCH PATHS, 535 I
Headers, 29
@i keyword, 423
library targets, 68
I/O Activity instrument, 475
prefix, 60
IBAction type
Heads-up display (HUD) window, 163
linking controls to actions, 165
Height setting for views, 178
menu actions, 291
Hello World project, 18
table clicks, 315–316
building and running, 22–24
unit testing, 233
creating, 18–21
unwind segues, 215–216
deleting, 24
IBOutlet type
Help
array controllers, 302
application bundles, 374
bindings, 307
Help menu, 414–415
constraints, 176
lldb, 491–492
outlets, 161–165
Quick Help, 411–413, 421–424
help, 491
removing, 522
help breakpoint, 492
view controllers, 154
ibtool tool, 455
Help menu, 414–415
iCloud capabilities, 262
HFS+ filesystem, 524
.icns files, 359, 361, 363
Hide Missing Symbols, 466
Icons
Hide/Show Debug Area button, 37
Hide System Libraries, 243, 252, 466
launch images, 201–202
Hide Toolbar, 494 localizations, 359–363
Hiding Debug area, 41 .iconset directory, 361–363

Highlight style, 308 iconutil tool, 363

HOME, 528 Identifier popup, 206

Homebrew package manager, 549 Identifier setting in localizations, 360–361

Hooking up outlets, 164–165 Ignored file state, 76

Hopper Disassembler tool, 47, 547 Image sets, 198–199

Horizontal Center in Container, 182 Image Views, 197–198

Host a Git Repository, 502 Images. See Graphics

Hosted repositories can be created by setting, Images.xcassets catalog, 199


501 contents, 362
Hot key combinations, 471 icons, 359
570 Index

Images.xcassets catalog (continued ) schemes, 485–486


OS X applications, 280 tests, 222, 504
overview, 109 InfoPlist EXPAND BUILD SETTINGS, 536
Implicit dependencies, 69–70 INFOPLIST FILE, 270, 370, 535
#import directive, 58 INFOPLIST OUTPUT FORMAT, 407, 536
Import Energy Diagnostics from Device, 478 InfoPlist.strings, 340, 345, 370
In-app purchases, 263 Inherited setting, 512
In-house distributions, 262, 270 initialize function, 170
In Project, 514 initWithFrame method, 332, 334

In Workspace, 514 INPUT FILE BASE, 448

#include directive, 58, 442 INPUT FILE DIR, 448

Include Spotlight Importer, 279 INPUT FILE NAME, 448


INPUT FILE PATH, 448
Increase Deck Size, 470
Input/output instruments, 475
Indentation tab, 22, 28
Insert Pattern, 85
Indexed setting, 244
insertNewObject method, 138
Indexing, 57–58
Inspection Range control, 251, 463–464
Individuals in Apple developer programs, 256
install action for xcodebuild, 444
Info.plist file, 408
INSTALL PATH, 386
application keys, 371–373
Installing
background modes, 263
docsets, 429
builds, 270–272, 456
frameworks, 383–387
bundles, 367, 369–370, 374, 379
Xcode, 10–11
gloss effect, 201
installsrc action, 444
localizations, 353–354, 360, 370 Instruction, 495
OS X applications, 280 Instrument Specific, 463
packages, 365–366 Instruments, 473
property lists, 397, 399 behavior, 474
settings, 535–536 configuration, 468–470
signatures, 262 Core Data, 474
Info tab custom, 480–482
allocations, 248 Dispatch, 474
application keys, 373–374 filesystem, 475
builds, 438–439, 441 Garbage Collection, 475
Info.plist file, 369 input/output, 475
localizations, 338, 360, 362 iOS energy, 478–479
property lists, 382, 396–397 Library window, 467–468
Quick Help, 412 master tracks, 476
Index 571

memory, 476–477 iOS


overview, 459–460 application bundles, 371–373, 376–379
recording, 470–472 application submissions, 261–262
running, 460–461 autolayout. See Autolayout
saving and reopening, 472–473 capabilities, 262–263
speed analysis, 240–243 controllers. See Controllers
system, 477–478 energy instruments, 478–479
templates, 482–483 measurement and analysis. See
Measurement and analysis
threads/locks, 479
model. See Models
trace, 479–480
MVC design pattern, 103–106
trace document window, 461–467
as packages, 369
tricks, 518
porting from, 282–286
UI automation, 480
provisioning. See Provisioning
user interface, 480
scheme options, 487–488
Integration, 499
starting projects, 106–108
bots, 503–508
table cells. See Tables and table cells
building for distribution, 508–509
templates, 108–110
Xcode Server, 500–503
unit testing. See Unit testing
Intentions for views, 157
view controllers. See View controllers
Inter-App Audio service, 263
“iOS Debugging Magic (TN2239)”, 518
Interface Builder
iOS Enterprise developer program
autolayout, 174 Apple developer programs, 256
class names, 135 build settings, 270–271
constraints, 175–176, 179 iOS distributions, 262
control actions, 291 iOS icon is pre-rendered, 201
labels, 180–181 iOS Simulator
localizations, 341 layouts, 156
outlets, 161, 165, 188 limitations, 191, 238
property editing, 289 memory, 248, 476
table views, 296, 298 speed analysis, 238
view controllers, 148–151, 154, 216 starting, 110
Interface Builder tab, 42, 150 templates, 482–483
Intermediate compiler products, 58–62 tests, 227
Interpreted languages, 54 IPHONEOS DEPLOYMENT TARGET, 535
Intrinsic sizes, 181 ISO-standard languages, 337
Invert Call Tree, 242, 252, 466 Issue Navigator Detail, 56
572 Index

Issues: Show live issues, 54 constraints, 179–185


Items of New Constraints, 161, 178–179 tags, 194
Language & Region panel, 337
Language & Text panel, 354
J Language tab, 337
JavaThread instrument, 479 Languages, 337
Join a Program, 256 Launch behavior for bundles, 374–375
Jump bars Launch due to a background fetch event, 488
Assistant editor, 315 Launch images, 201–202
description, 150–151 Launch Services, 360

object controllers, 302 Layering NSControllers, 307–315


Laying out document window, 295–301
Layout guides for views, 157
K Layout rectangles, 308
LD DYLIB INSTALL NAME, 386
Kaleidoscope tool, 547–548
Leading edges of views, 178, 206
Keep in Dock, 461
Leaks instrument, 476, 518
Key Bindings panel
Left-side group for labels, 158–160
controllers, 139
.lemon files, 448
Preferences window, 513
Levels for build settings, 435–437
Key Equivalent field, 288
libcrypto API, 9
Key paths, 334
Libraries
Key-Value Coding (KVC), 167, 211, 301, 334
adding, 69–70
Key-Value Observing (KVO), 301–302
dynamic, 52–53
Key-value pairs
frameworks, 385–386
localizations, 347 instruments, 467–468, 474
property lists, 400–401 Interface Builder, 296
Keyboard panel for shortcuts, 39, 376 object files, 51
Keyboard Shortcuts tab, 376 static, 63, 519
Keychain sharing, 263 targets. See Library targets
Keys for applications, 371–376 trace document window, 463
KVC (Key-Value Coding), 167, 211, 301, 334 /Library/Developer directory, 11–12
KVO (Key-Value Observing), 301–302 Library navigator, 420
Library palette, 474
LIBRARY SEARCH PATHS, 535
L
Library targets, 63
Labels adding, 63–65
building views, 158–160 debugging, 70
Index 573

dependent, 68–70 base, 338–339


description, 64–65 bringing files into, 352
headers, 68 document types, 360–363
membership, 65–68 icons, 359–363
Library window, 467–468 Info.plist, 353–354, 370
Licenses for MonoTouch, 554 MainMenu.xib, 347–351
Line Break popup, 314–315 overview, 337–338
Line Graph style, 469 process, 339–345
Line wrapping: Wrap lines to editor width, 22 strings, 355–358
Link Binary With Libraries build phase, 50, 52, trying out, 345–347
61, 110, 432 localizedStringForKey method, 356
Linking and linkers Locations
editing, 51 Doxygen, 426
editors, 208–209 frameworks, 385–386
process, 50–52 settings, 530–532
tricks, 519 workspaces, 522
Lion, 264
Locks instruments, 479
lipo tool, 454
Log Message, 490
Live Autoresizing, 309
Log navigator for builds, 449
lldb debugger
Log view for Comparison editor, 93, 95–96
command line, 491–493
Logic tests, 232
overview, 389–392
Login button.png, 368
LLDB Quick Start Guide, 493
Logs
.lldbinit files, 493
vs. breakpoints, 488–489
llvm library, 53–54, 140
builds, 448–449
Loading
Look up API Documentation, 467
dynamic, 52–53
lproj system, 337–338
MPRDocument data, 289–293
LSApplicationCategoryType key, 374
loadView method, 148
LSBackgroundOnly key, 374
Local analysis, 54–56
LSEnvironment key, 375
Local remote repositories, 80–82
LSFileQuarantineEnabled key, 375
Local variables, 37
LSFileQuarantineExcludedPathPatterns
Locales, 340 key, 376
Localizable.strings file, 357–358 LSGetAppDiedEvents key, 375
Localizations, 337 LSMinimumSystemVersion key, 375
adding, 338–347 LSMinimumSystemVersionByArchitecture
application bundles, 373 key, 375
574 Index

LSMultipleInstancesProhibited key, 375 source control and product files,


LSRequiresIPhoneOS key, 376 128–131
LSUIElement key, 375 test data, 126–128
LSUIPresentationMode key, 375 Managed Object Context binding, 303–304
Mark Heap, 518
Mark Selected Files As Resolved, 77
M Master branches in version control systems, 97
Mac App Store. See App Store Master-Detail Application template, 152
Mac Developer identity, 267 Master track instruments, 476
Mac Installer Package, 388 Mavericks, 10
Mac OS X. See OS X arguments, 307
MAC OS X PRODUCT BUILD VERSION, command-line tools, 11
529 energy-saving strategies, 293
MAC OS X VERSION ACTUAL, 528–529 garbage collection, 475
MAC OS X VERSION MAJOR, 529 state restoration feature, 291
MAC OS X VERSION MINOR, 529 support, 14
Machine instructions, 49 system libraries, 61
MacOS directory, 369 Mavericks Server, 74, 502
MacPorts package manager, 549 Maximum attribute, 115, 314
Mailing lists, 541–542 Measurement and analysis, 237
main.m file, 280 memory, 247–253
Main.storyboard file, 108 speed. See Speed
MainMenu.xib file, 287 Meetings, 544
localizations, 347–351 Membership, target, 65–68
OS X applications, 280 Memory, 247–248
Makefile goals, 431 allocations, 248–250
malloc function, 459 bar graphs, 291
MallocDebug application, 459 instruments, 476–477
Manage Flags, 477 object type focus, 250–252
Manage PM Events, 477 problems, 518
Manage Schemes editor, 223 RAM, 49
bots, 504 reports, 291–293
listing schemes, 223 requirements, 10
new schemes, 272 transients, 252–253
Managed-object classes, 113, 120 Memory Monitor instrument, 477
creating, 120–124 Menus, wiring, 287–288
extending, 124–126 First Responder, 289
Index 575

MPRDocument data, 289–293 managed-object classes. See


targets and actions, 288 Managed-object classes
Merge editor, 91 OS X applications, 281–286
Merge from Branch, 97 relationships, 117–119
Modern bundles, 367
Merge into Branch, 97
Modified file state, 76–77
Merges in version control systems, 83–93
module.map file, 61
Messages
Modules, 60–62
analysis, 56
Modules extension, 52
Documentation window, 419
mogenerator tool, 123–124, 548
logs, 490
MonoTouch framework, 553–554
Objective-C compilers, 524
More Developer Tools, 15
Metadata in Git, 76
motion tool, 553
Method names, refactoring, 134
Mountain Lion, 8, 10
MIME Type setting, 360–361
command-line tools, 11
Min Length setting, 117
Gatekeeper, 266
Mini instruments, 471–472
Mouse pointer variables, 37
Minimum attribute, 115, 314
Move Breakpoint To, 493
missing-braces-and-parentheses warning, 140
MPRDocument class
MKDirectionsApplicationSupportedModes key,
loading data into, 289–293
379
OS X applications, 279–280
Modal scenes, 205–210
MPRDocument.xcdatamodeld file, 280
Mode settings
MPRDocument.xib file
Doxygen, 426–427
attributes, 308
object controllers, 302
bindings, 315
Model controllers in OS X applications, 280
compiling, 280
Model Key Path setting, 304–305
object controllers, 302
Model-to-View support, 189–190
table view, 296
Model-View-Controller (MVC) design pattern,
MPRGameViewController.xib file, 318, 355
103–104
MPRPassCompletionView class, 324–325
controllers, 106
MPRPasserGraphController class, 323–325,
models, 104 328–332, 338, 352
views, 104–106 Multithreading, 169
Models
MVC (Model-View-Controller) design pattern,
attributes, 114–117 103–104
debugging, 131 controllers, 106
entities, 114 models, 104
implementing, 113 views, 104–106
576 Index

N New Target assistant, 63, 381


.nib files, 135
Name labels, 158–159
Nil pointers, 169
Names
nm tool, 60
localizations, 360
No Access, 264
product, 279
No Action delete rule, 118
refactoring, 134–136
No Selection Placeholder field, 312
nan (not a number), 35
Normalizing entities, 282
NATIVE ARCH, 533
Not a number (nan), 35
NATIVE ARCH 32 BIT, 533
not-enough-fields.csv file, 226
NATIVE ARCH 64 BIT, 533
“not key value coding-compliant” exceptions,
Navigation panel for gestures, 517
307
Navigators, 20
NS BLOCK ASSERTIONS macro, 511–512
Breakpoint, 141 NSAlert, 357
Debug, 191–192 NSAppleScriptEnabled key, 376
detail settings, 56 NSApplicationMain function, 280
Documentation window, 415 NSApplicationShowExceptions setting, 497
Issue navigator, 29 NSArray class, 143
Library, 420 NSArrayController class, 302–303
Log, 449 NSBindingDebugLogLevel setting, 307
Project, 36 NSBundle class, 337, 356
Symbol, 57 NSCoder Night meetings, 544
NDEBUG macro, 511 NSControl class, 315
Net resources, 540–543 NSController class, 303, 307–315
Network Activity instrument, 479 NSDateFormatter class, 168
Network Activity Monitor instrument, 477, 479 NSError class, 54–55, 228
Network capabilities, 264 NSFetchedResultsController class, 109, 136,
New Branch, 97 187, 189
New File assistant, 26–27 NSFileWrapper class, 367
New Folder NSHumanReadableCopyright key, 372, 374
Doxygen, 426 NSLocalizedString class, 357
subclasses, 121 NSLog function, 489–490
New Project assistant, 18–19, 26 NSMainNibFile key, 372
iOS, 106 NSManagedObject class
OS X, 278 MVC model, 103
New Scope, 514 subclass creation, 120–121
New Tab, 42, 150 NSManagedObjectCollector class, 303
Index 577

NSNumberFormatter class, 168 Open Anyway, 425


NSObject class, 103 Open Keyboard Shortcut Preferences, 471
NSObjectController class, 318 Open Link in New Tab, 417
NSPopover, 323 Open Other, 18
NSPrincipalClass key, 371 Open Quickly dialog, 413–414
NSRTFDPboardType file type, 366 Open Recent, 24
NSScrollView, 523 OpenCL facility, 53
NSServices key, 376 OpenGL Driver instrument, 475
NSSortDescriptor class, 137 OpenGL ES Analyzer instrument, 475
NSString class, 168 OpenGL ES Driver instrument, 475
NSSupportsSuddenTermination key, 375 OpenGL ES Frame Capture, 488
NSTableView class, 315 Optimization
NSTextView, 523 compiler, 48–49
NSViewController class, 318 speed, 243–247
NSZombieEnabled setting, 488 tricks, 519–520
Null Placeholder field, 312 Option key, 517

Nullify delete rule, 118 Optional for libraries, 69

Numbers Options for trace document window, 463

data formatters, 313–314 Options panel, 19

property lists, 395–396, 406 Options tab


schemes, 486–487
O state-restoration feature, 291
Ordered lists, 395–396, 407
.o files, 432
Ordered for relationships, 117
objc-language list, 542
Organization Name setting
Object allocations by class, 459
iOS projects, 106
Object controllers, 302–304
new projects, 20
Object controllers chain, 310–311
OS X projects, 279
OBJECT FILE DIR, 532
Organizations in Apple developer programs,
Object files, 50–51 256
Object Graph instrument, 476 Organizer window
Objective-C derived files, 531
alternatives, 553–554 snapshots, 89
class names, 120 trash, 24
compiler messages, 524 workspaces, 521
OBJROOT, 531 Orientation setting, 179
Omni Group, 542 Origin control for views, 324
Open in instruments, 473 -Os optimization, 519
578 Index

OS X, 275, 277 Packages, 365


autolayout, 318–320 downloading, 14–15
bindings. See Bindings RTFD, 365–367
bundles. See Bundles PaintCode tool, 548
capabilities, 262–263 @param keyword, 422
command-line arguments, 347 Passer Array Controller, 311–312
custom views. See Custom views Passer controller bindings, 309–310
entities, 282–286 Passer ratings project overview
frameworks. See Frameworks building, 29–31
goals, 277–278 controllers, 144–145
localizations. See Localizations creating, 25–29
models, 281–286 debugging, 32–34
porting from iOS, 282–286 running, 31–32
property lists. See Property lists test case, 35
running, 321 Passer table, binding, 311–312
sandboxing, 264–266 PasserGroup framework, 382–383
starting applications, 278–281 Passing data to editor, 213–215
wiring menus, 287–293 Paste for dictionaries, 401
“OS X Debugging Magic (TN2124)”, 518 Pboard Types setting, 361
OSAScriptingDefinition key, 376 .pch files, 60, 452
OTHER CFLAGS, 534–535 Peak Graph style, 469
OTHER CODE SIGN FLAGS, 530 Performance bar charts, 32
otool tool, 60 Performance optimization
Outlets compiler, 48–49
building views, 153–154 speed, 243–247
code completion and snippets, tricks, 519–520
168–170
Permissions settings for bots, 505
connections, 164–168
Persistent State: Launch application without
hooking up, 164–165 state restoration, 487
overview, 161–164 Phases, build, 432–433
table view, 187–188 PhoneGap framework, 551
Output panel in Doxygen, 427 Pin popover, 177–178, 184
Overlay for instruments, 470 Pixels for icons, 201
Plain style, 209
P Planning apps, 103–106
@p keyword, 423 platform in lldb, 492
Package managers, 548–549 PLATFORM NAME, 528
Index 579

Playback head in trace document window, code-folding ribbon, 515–516


464 controllers, 139
Player billboard
Developer ID, 266
label constraints, 179–185
docsets, 420
size constraints, 175–179
downloads, 11, 15
PLIST FILE OUTPUT FORMAT, 407
fonts, 32
Plists. See Property lists
indentation, 28
Plugins, 334
instruments, 471
plutil tool, 406–407
key equivalents, 513
po command, 494–495
navigational gestures, 517
Point Graph style, 469
Navigator detail, 56
Pointers
Cocoa programming, 54 remote repositories, 79, 82, 84
nil, 169 snapshot locations, 522
Points for icons, 201 source trees, 537
Popovers team membership, 258–259
bindings, 315–320 version control, 74
Quick Help, 412–413 warnings and errors, 54
segues, 218 Prefix files, 60, 280
variable values, 37 Prefix headers, 60
Populating frameworks, 382–383 Prepares Content, 302, 310
Portals for iOS, 261 Preprocessing xcconfig files, 442–443
Porting from iOS, 282–286 Preprocessors, 58–59
POSIX working directory, 487 Prerelease versions, 13
#pragma mark directive, 188 Preview assistant, 155
PRAppDelegate class, 108 Preview, 88–89
PRDetailViewController class, 109, 147 Preview view, 156–157
Precompilation, 60–62 PRGameListController class, 150, 165–168,
Preferences window 189–190, 194
Apple ID, 256 Priority setting for centering, 183
archives, 261 Private keys for certificates, 261
automatic features, 22 Private role, 68
behaviors, 40–42 PRMasterViewController class, 109,
bindings, 139 133–146
bots, 504 Pro Git version control system, 549
code completion, 28, 168 Probes, 481
580 Index

process in lldb, 492 Property List editor, 370


Process instrument, 477 limitations, 404–406
Processor requirements, 10 working with, 399–404
Product files in managed-object classes, Property lists, 395
128–131 binary, 407
Product Name setting, 20, 278–279 data types, 395–396, 406–407
Profiles editing, 396–406
applications, 240 specialized, 407–408
provisioning, 257–260 text, 406–407
Program members, 259 Protecting assets, 261
PROJECT DIR, 530 @protocol, 325
Project editor Protocol methods, 188–189
library targets, 63–64 Prototype cells, 190–191, 193
localizations, 339 Provide Feedback link, 421
PROJECT FILE PATH, 530 Provisioning, 255, 257
PROJECT NAME, 528 asset protection, 261
Project navigator, 36 capabilities editor, 262–263
project for xcodebuild, 444 distribution builds, 269–273
Project role, 68 Gatekeeper and Developer ID,
266–269
PROJECT, 528
OS X sandboxing, 264–266
Projects list for builds, 432
profiles, 257–260
Projects organizer for workspaces,
521 registering apps, 258–260
Projects overview submitting applications, 261–262
building, 22–24, 29–31 PROVISIONING PROFILE, 270, 530
PRPasser class, 187–188, 192, 208–210
creating, 18–21, 25–29
PRPasserEditController class, 205, 210,
debugging, 32–34
213–214
deleting, 24
PRPasserEditTableController class, 208, 210
Doxygen settings, 425–428
PRPasserListController class, 150, 152,
running, 22–24, 31–32 187, 208, 210, 214–217
templates, 108–110 PRTeam class, 283
Projects panel Public role, 68
derived files, 531 Pull, 90
snapshots, 89 Push, 83, 90
Properties Push segues, 152
custom views, 334–336 Pushing to remote repositories, 83
entities, 113 pwrite function, 481
Index 581

Q Region setting, 354


Registered developers, 13, 259
Quick Help facility, 411–413
Registering
comment syntax, 422–424 apps, 258–260
generating, 421–422 team membership, 258
Quick Help for Selected Item, 412, 415
Regular expressions
QuickLook feature, 332–334 refactoring method names, 134
Quit searches, 85
lldb, 491 traps, 523
OS X, 33 Relationships, 113–114, 117–119
Quit Xcode, 24 Relative to Group, 513
Relaunch, 354
R Release build configuration, 452
Release Notes section, 415
Raises For Not Applicable Keys, 304
Remote repositories, 79–83
rake, 553
Remotes tab, 82
RAM, 49
Removing
RatingTest class, 230
breakpoints, 36
Read Access, 264
Xcode, 11–12
Read/Write Access, 264
Renaming service, 514
Reads/Writes instrument, 475, 480–481 Renaming symbols, 133–136
Recent for builds, 449 Rentzsch, Jon “Wolf”, 123
Record Reopening instruments, 472–473
instruments, 473 Replace All in File, 84–85
trace document window, 463 Replace segues, 218
Record Options, 472–473 Repositories
Recording instruments, 470–472 cloning, 79
Rectangles remote, 79–83
bounds, 308 settings, 503
layout, 160, 308 turning on, 503
Refactoring feature, 57 Xcode Server, 79–80, 501–502
class names, 134–136 Repositories tab, 500
method names, 134 Required for libraries, 69
Reference Language column, 340 Requirements, 10
Reference URL setting, 361 Reset to Suggested Constraints, 180
References resizableImageWithCapInsets method, 200
folders, 512–513 Resolve Auto Layout Issues menu, 206
repositories, 80 Resource forks, 365
582 Index

Resource Manager, 365 S


Resources
sample-data.csv file, 128–130, 227, 237,
books, 539–540 252, 289, 291
Developer Technical Support, 542 Sampler instrument, 477–478
face to face, 544 Sandboxing
Net, 540–543 benefits, 265
sites and blogs, 542–543 disadvantages, 266
software, 544–554 OS X, 264–266
Resources directory, 369 Save as Template, 472
Responder chains, 288 Save as Workspace, 520
Retrieving data from editor, 215–217
Save-file dialog for targets, 67
@return keyword, 422
Saving instruments, 472–473
Return Value, 493
Scan recursively, 426
Reveal in Library, 417
scanf function, 32, 47–48
Rich text file directory (RTFD) package,
Scenes
365–367
modal, 205–210
Right-side group for labels, 158–159
view controllers, 148–151
Role setting for localizations, 360
Schedules
Root view controller segues, 152
bots, 504
Routing App Coverage File, 488
instruments, 479
Row Height setting for table cells, 194
Scheme control, 68
RTF editor for localizations, 342
Scheme editor, 70
RTFD (rich text file directory) package,
365–367 binding debugging, 307
RubyMotion framework, 553 instrument templates, 241
Rules, build, 446–448 state-restoration feature, 291
Run Browser, 463 tests, 222
Run scheme editor, 485 scheme for xcodebuild, 445
Run Script editor, 127 Schemes
Running bots, 503
bindings, 305–307 options, 485–488
bots, 506 Scopes, defining, 514–515
Doxygen, 428–429 Scroll View, 324
instruments, 460–461 SDKROOT, 530
OS X applications, 321 SDKs (software development kits), 9
projects, 22–24, 31–32 build settings, 441–442
tests, 227–228 iOS projects, 108
Index 583

Search Documentation for Selected Text Show All Results, 417


section, 415 Show Bounds/Layout Rectangles, 176
Search in help, 414 Show Bounds Rectangles, 308
Search paths for settings, 535 Show: Code folding ribbon, 22, 515
Searches Show Definitions, 438, 528
Documentation window, 417–419 Show environment settings in build log, 527
files, 514 Show Find Options, 522
trace document window, 463 Show Group Banners, 468
version control, 84–85 Show/Hide...debugger, 40
Security & Privacy panel, 425 Show/Hide...navigator, 40
@see keyword, 423 Show HTML output, 429
Segues Show In Finder, 24, 519
passer list, 208 Show Layout Rectangles, 160, 308
types, 218 Show live issues, 22, 139

unwind, 215–216 Show navigator, 42

view controllers, 148–151 Show Obj-C Only, 466


Show Package Contents, 10, 366, 369, 421
views, 152
Show Raw Values & Keys, 408
Select and Edit, 183
Show Resize Knobs, 181
Selective commits, 85–87
Show Setting Names, 438, 528
sender method, 209, 213
Show Setting Titles, 528
Separate by Category, 465–466
Show Slicing, 201
Separate by Thread, 466
Show tab named, 42
Services menu, 471
Show Vertical Scroller, 324
Settings tab
Signals from exceptions, 141
repositories, 503
Signatures in iOS provisioning, 257
Xcode panel, 500
Signing identities, 257, 458
Shadow Offset, 159
SimpleCSVFile, 224
Shadows for labels, 159 Simulate Document, 299
SHALLOW BUNDLE, 532 Simulate Location, 39
Share Breakpoint, 493 Simulated Metrics attribute, 179
Shared Memory instrument, 476 Sites, 542–543
Shared User Defaults Controller, 304 64-bit applications, 52–53
Shift key, 517 Size and Size Inspector, 155, 157
Shortcuts columns, 297
function keys, 39 constraints, 175–179
instruments, 471 document window, 299–301
lldb, 493 labels, 183
584 Index

Size and Size Inspector (continued ) SourceTree version control system, 550
table cells, 194 Specialized property lists, 407–408
views, 324, 716 Speed, 237–238
Skip Install, 387 Debug navigator, 238–239
Sleep/Wake instrument, 479 instruments, 240–243
SMAuthorizedClients key, 376 memory, 247–253
SMPrivilegedExecutables key, 376 optimization, 243–247
Snap to Guides, 309 Spin Monitor instrument, 478
Snap Track to Fit, 248 Splash screens, 201

Snapshot Now, 477 Springs, 300

Snapshots SQLite, 113

projects, 89 SRCROOT, 127–128, 444, 530


Stack Libraries style, 469
VM Tracker, 477
Stack traces, 32
Snippets, 169–170
displaying, 141–142
Software development kits (SDKs), 9
Extended Detail view, 482
build settings, 441–442
filtering, 142
iOS projects, 108
trace document window, 467
Software resources, 544–545
Stacked for instruments, 470
AppCode, 550–551
Staged file state, 76–77
assessment, 552
Standard Windowing, 518
Cocoa alternatives, 551–552
Starting
helpers, 546–548
iOS projects, 106–108
package managers, 548–549
Xcode, 17–18
text editors, 545–546 State-restoration feature, 291
version control, 549–550 States of files, 76–77
sortDescriptors property, 321 Static libraries (.a), 63, 519
Source code Static table cells, 205, 209–210
description, 45 Statistics to Graph settings, 470, 482
Doxygen, 426 Step Into (F7), 39, 495–496
property lists, 404 Step Out (F8), 39
Source control. See Version control systems Step Over (F6), 39, 495–496
Source Control menu, 75–76, 80, 82 Stepping through code, 37–39, 495–496
Source Control, 522 Stop
Source files with names matching, 447 debugging, 33
Source Locations settings, 530 instruments, 242, 470
Source trees settings, 537 iOS, 145
Sources & Binaries, 425 Storyboard editor for segues, 218
Index 585

.storyboardc files, 135 SYMROOT, 531


Storyboards for view controllers, 148–151 Syntax-aware indenting settings, 22, 28
Strings and .strings files System instruments, 477–478
builds, 454 System Calls instrument, 479
data formatters, 314–315 system keychain, 509
localizations, 347–349, 355–358 SYSTEM LIBRARY DIR, 536
property lists, 395–396, 406–407 System Preferences application
STRINGS FILE OUTPUT ENCODING, 536 function keys, 39
Structure gestures, 30, 417
application bundles, 371–372, 374, instruments, 471, 476
376–377 localizations, 337, 345, 354
builds, 431–434 security, 425
Structured directory trees, 367 services, 376
Struts, 300
Style settings
buttons, 206 T
dates, 315 Table of contents sidebar, 415–416
instruments, 469 Tables and table cells, 187
models, 114 custom, 193–196
table cells, 209 graphics. See Graphics
Sublime Text 2 text editor, 546 modal scenes, 205
Submit to the Mac App Store Package, 387 OS X, 296–299
Submitting iOS applications, 261–262 outlets, 187–188
Subpath field for frameworks, 386 prototype, 190–191
Sudden Termination instrument, 474 static, 205, 209–210
Suggest completions while typing, 168 table views, 136–137, 161, 207
Summary tab tableView property, 187
property lists, 397 Tabs
targets, 369, 374 creating, 150
Supporting Files group, 109 Documentation window, 417
Suppressing warnings, 145 switching, 42
Switch-Branch sheet, 98 Tags
Switch to Branch, 97–98 labels, 194
Symbol navigator, 57 version control, 523
Symbols, 49 TARGET BUILD DIR, 531
renaming, 133–136 target in lldb, 492
tokens, 54 target for xcodebuild, 444
586 Index

Targeted for iPad, 148 Team array controller, 302–303, 310–311


Targets and Target editor Team class, 283
ad hoc variants, 272 Team Members in Apple developer programs,
asset-catalog file, 200 256, 258
build phases, 50, 432–433 Team popup for iOS projects, 107
build rules, 447 Team Provisioning Profiles, 260
build settings, 434–435 Team table for bindings, 305
bundles, 523 tearDown method, 224
capabilities, 264 Templates
code size, 511 instruments, 241, 472, 482–483
components, 63–64 iOS projects, 108–110
configuration files, 439, 441 Temporary exceptions, 265
dependencies, 70 Terminal application, 24
device families, 377 test action for xcodebuild, 444
displaying, 222 Test data for unit testing, 226–227
frameworks, 381–383, 386 Test navigator, 222–223
icons, 200, 272, 359–360 Test suites, 221
images, 200, 378 Test tab for bots, 508
Info.plist file, 280, 369–370, 372–374, testCalculation method, 231
382
testExample method, 224
instruments, 468
Testing
iOS projects, 107–108
unit. See Unit testing
levels, 436–437
views, 170–171
libraries. See Library targets
TestKit assertions, 233–235
localizations, 362
testTooManyFieldsError method, 225,
new projects, 26–27 228–229
packages, 370 Text
product names, 279
containers, 183
property lists, 396–397
property lists, 395–396, 406–407
provisioning profiles, 258
Text Color control, 159
Quick Help, 412, 422
Text Editing panel, 22, 516
registering apps, 258
Text editors, 545–546
trace document window, 462–463
TextEdit application, 365–366
wiring menus, 288
TextMate 1.5 text editor, 545
Team Admins in Apple developer programs,
256 TextMate 2 text editor, 545–546

Team Agents in Apple developer programs, TextWrangler text editor, 545


256 Third-party package managers, 549
Index 587

3rd Party Mac Developer Application identity, Transient attribute, 115


267 Transients, cleaning up, 252–253
3rd Party Mac Developer Installer identity, Traps, tricks for, 522–524
267
Trash, 24
32-bit applications, 52–53
Tricks
Thread
Assistant editor, 515–517
in debugging, 495–496 building, 518–520
lldb, 492 code-folding ribbon, 515–516
Threads instruments, 479 general, 511–515
Time Profilers for instruments, 240–241, 244, instruments and debugging, 518
469, 471, 478
traps, 522–524
Titanium API, 551–552
workspaces, 520–522
Titles
Truncate Middle, 314–315
buttons, 206
Truncation, 313
columns, 298
Two developer-program memberships, 270
menu items, 288 2010-data-calculated.csv file, 226–227
@todo keyword, 423
Type menu
Toggle Instruments Recording, 471
instruments, 470
Tokens, 54 new projects, 20
too-many-fields.csv file, 226
Toolbars
modal scenes, 205–206 U
trace document window, 462–464 UI automation instruments, 480
Tools in Interface Builder, 149–151 UI-layout editors, 149
Top Layout Guide, 178, 206 UIAppFonts key, 377
Trace Call Duration, 467, 482 UIApplication class, 233
Trace document window, 461–462 UIApplicationDelegate protocol, 108
Detail area, 465–466 UIApplicationExitsOnSuspend key, 378
Extended Detail area, 467 UIApplicationMain method, 242
toolbar, 462–464 UIBackgroundModes key, 378
Track area, 464–465 UIDeviceFamily key, 377
Trace Highlights, 467 UIFileSharingEnabled key, 378
Trace instruments, 479–480 UIImage class, 200–201
Track area in trace document window, UIImageView class, 197
464–465 UIInterfaceOrientation key, 377
Track Display, 470 UIKit framework, 301
Trailing edges in views, 178, 206 UILabel class, 160
Transcripts for builds, 450–458 UILaunchImageFile key, 378
588 Index

UILaunchImages key, 378 Unknown file state, 78


UIMainStoryboardFile key, 376 UNLOCALIZED RESOURCES FOLDER PATH,
UINavigationController class, 152 532

UIPrerenderedIcon key, 378 Unmerged file state, 77

UIRequiredDeviceCapabilities key, 377 Unmodified file state, 77

UIRequiresPersistentWiFi key, 377 Unresolved addresses, back-filling, 51


Untracked file state, 76
UISlider controls, 233
Unwind segues, 215
UIStatusBarHidden key, 377
Update All Frames in Container, 160
UIStatusBarStyle key, 377
Update All Frames in Game List Controller,
UISupportedExternalAccessoryProtocols key,
185
377
Update Constraints, 180
UISupportedInterfaceOrientations key,
377–378 Update Frame, 180
UITableView class, 136, 194, 207 Update Frames menu, 161, 178
UITableViewCell class, 136, 191, 193, 196, Update Frames, 179
208 URLs for application bundles, 373
UITableViewController class, 109, 207–208 Use Autolayout, 296
UITableViewDataSource class, 188 Use Base Internationalization, 338
UITableViewDelegate class, 188, 214 Use Core Data
UIView class, 105–106, 194 iOS projects, 107
UIViewController class, 106, 133, 147–148, OS X applications, 279
161, 187, 207 Use dot tool from the GraphViz package, 427
UIViewEdgeAntialiasing key, 378 Use scalar properties for primitive data types,
UIViewGroupOpacity key, 378 121
Umbrella headers, 61 User and System Libraries style, 469
Undefined attributes, 115 User Defined Runtime Attributes settings,
334–335
Undo, 183
User Info settings for models, 116
Unformatted field, 314
User information for application bundles,
Unit testing
372–373
application tests, 232–233 User interface instruments, 476, 480
CSV Reader, 224–228 User presentation in application bundles,
overview, 221–222 377–378
test navigator, 222–223 USER, 528
testing and debugger, 229–232 Using popup for build rules, 447
TestKit assertions, 233–235 /usr/bin directories, 11
Universal (fat) binaries, 454 UTExportedTypeDeclarations key, 373, 408
Universally unique identifiers (UUIDs), 392 Utility area, 65, 150
Index 589

UTImportedTypeDeclarations key, 373 editing, 136–138


UUIDs (universally unique identifiers), 392 embedded, 206–208
OS X applications, 280
V outlets. See Outlets
storyboards, scenes, and segues,
Validation field for attributes, 115 148–151
Value Transformer setting, 304 table views, 161
valueForKeyPath method, 126 View Details, 259
Variables View menu, deleting, 287
build. See Build settings View selector, 23
data tips, 332–333 viewDidLoad method, 208, 210–211,
Debug area, 32 213–214
Variables pane, 37–38, 143, 333, 495 Views
Version control systems, 25, 73–74 autolayout in. See Autolayout
branching, 96–98 building. See Building views
commits, 78–79 constraints, 157, 174–176
file state, 76–77 custom. See Custom views
managed-object classes, 128–131 graphing, 325–328
merges and conflicts, 83–93 MVC model, 103–106
remote repositories, 79–83 table, 136–137, 161, 207
software, 549–550 testing, 170–171
tags, 523 VM Operations instrument, 479
Version editor, 93–96 VM Tracker instrument, 476
working with, 74–76
workspaces, 522
W
Xcode with Git, 77–78
Version Control with Subversion system, @warning keyword, 423
549 Warnings
Version editor, 93–96 compiler, 29–30, 518
Versioned bundles, 367 disclosure triangles, 188
Versions version control system, 550 displaying, 54, 56
vi text editor, 546 suppressing, 145
View control, 31, 42, 115 Watchdog timer, 237
View controllers, 133, 328–332 watchpoint command family, 495
adding, 147–148 Web, bot creation on, 505–506
building views. See Building views Welcome to Xcode window, 17–18
590 Index

What’s New in Xcode section, 415 Xcode icon, 17


WiFi instrument, 478 Xcode Overview section, 415
Wildcard patterns in searches, 85 xcode-select tool, 443, 445–446
Wiring menus, 287–288 Xcode Server
First Responder, 289 Accounts panel, 258
MPRDocument data, 289–293 overview, 500
targets and actions, 288 registering, 503
Wiring OS X applications. See Bindings repositories, 74, 79–81, 501–502
With XIB for user interface, 148, 162, 323 xcode-users list, 541–542

Wizard tab for Doxygen, 425, 427 XCODE VERSION ACTUAL, 529
xcodebuild tool, 435–436, 441, 443–445
WORA (write-once-run-anywhere) apps,
552 .xcodeproj package, 444
Working Directory: Use custom working xcrun tool, 443, 446
directory, 487 XCTAssert macros, 233, 235
workspace for xcodebuild, 444 XCTAssertEqual assertion, 226, 234–235
Workspace (or Project) Settings, 522 XCTAssertEqualObjects assertion, 235
Workspace tricks, 520–522 XCTAssertEqualWithAccuracy assertion,
Wow feature of Assistant editor, 516 234

WRAPPER EXTENSION, 532 XCTAssertFalse assertion, 234

WRAPPER SUFFIX, 532 XCTAssertNil assertion, 234


XCTAssertNotEqual assertion, 234
Write-once-run-anywhere (WORA) apps,
552 XCTAssertNotEqualObjects assertion, 235
XCTAssertNotEqualWithAccuracy assertion,
234
X XCTAssertNoThrow assertion, 235

x-code-select, 11 XCTAssertNoThrowSpecific assertion, 235

X coordinates for views, 324 XCTAssertNoThrowSpecificNamed assertion,


235
X11 package, 428
XCTAssertNotNil assertion, 226, 234
.xcarchive packages, 389, 393
XCTAssertThrows assertion, 235
.xcassets files, 199
XCTAssertThrowsSpecific assertion, 235
assets catalog contents, 362
XCTAssertThrowsSpecificNamed assertion,
icons, 359 235
OS X applications, 280 XCTAssertTrue assertion, 226, 234
overview, 109 XCTest assertion macro, 221, 235
xcconfig files, 439–443 XCTest class, 226
Xcode Archive, 388 XCTestCase class, 221
Index 591

XCTFail assertion, 234 Y


XCUnitTest class, 222–223
Y coordinates for views, 324
Xemacs text editor, 546
XIB files, 135
linking, 148
Z
owners, 161–162 Zombie technique, 488
XML zooming
property lists, 369–370, 399, 404–408 instruments, 470
refactoring names, 135–136 Interface Builder, 149
XPC services, 487 Zuckerberg, Mark, 552

You might also like