Xcode 4ISBN: 978-1-118-00759-4
Paperback
608 pages
June 2011
This title is out-of-print and not currently available for purchase from this site.
|
Preface xvii
Acknowledgments xix
Introduction xx
Part I: Getting Started 1
Chapter 1: Introducing Xcode 4 3
Understanding the History of Mac Development Tools 4
Looking back at early IDEs 4
Developing Xcode 5
Understanding Xcode 4’s Key Features 7
Moving to Xcode 4 9
Moving from the Xcode 3 to the Xcode 4 editor 10
Working with Interface Builder 16
Exploring code and file management 17
Exploring the debugger 19
Comparing iOS and OS X Development 20
Developing for OS X 20
Developing for iOS 22
OS X and iOS cross-development 23
Summary 24
Chapter 2: Getting and Installing Xcode 25
Selecting a Mac for Xcode 25
Choosing a processor 25
Selecting memory 26
Choosing a monitor 26
Working with disk storage 27
Choosing peripherals 28
Choosing supporting software 29
Signing Up for Development 30
Registering as a developer 31
Choosing a program 32
Accessing developer resources 36
Getting Started with Xcode 38
Installing Xcode 39
Creating and organizing project folders 42
Working with multiple versions of Xcode 44
Uninstalling Xcode 45
Summary 45
Chapter 3: Building Applications from Templates 47
Getting Started with Templates 47
Building a project from an application template 50
Looking inside the Application templates 57
Using the OS X Application templates 58
Understanding the iOS Application templates 62
Introducing the Framework and Library templates 69
Introducing Plug-in templates 70
Changing the Standard Templates 71
Finding the template files 71
Customizing the template files 72
Summary 74
Chapter 4: Navigating the Xcode Interface 75
Understanding the New Interface 75
Using the Navigation Area 77
The Project Navigator 77
The Symbol Navigator 79
The Search Navigator 82
The Issue Navigator and the Log Navigator 84
The Breakpoint Navigator and the Debug Navigator 88
Loading the navigators from menus and keyboard shortcuts 89
Using the Utility Area 90
Displaying file information 90
Using Quick Help 92
Using the library area 93
Working with the Editor Area 94
Getting started with code editing 95
Introducing build configurations 99
Summary 102
Chapter 5: Working with Files, Frameworks, and Classes 103
Working with Files and Classes 103
Adding new files to a project 104
Adding a new class 111
Adding new resources 112
Adding miscellaneous other files from the templates 112
Deleting and renaming files 113
Importing existing files 115
Reimporting missing files 116
Working with Groups 117
Moving groups and files 117
Creating a new group 118
Organizing groups 119
Working with Frameworks 119
Using frameworks 120
Adding existing frameworks 121
Summary 122
Chapter 6: Using Documentation 123
Understanding the Apple Documentation 125
Comparing iOS and OS X and their different versions 125
Understanding resource types 126
Using topics 136
Using frameworks and layers 138
Searching the online documentation 139
Using the Xcode Documentation Viewer 140
Browsing the documentation 141
Searching the documentation 143
Using class references 145
Accessing documentation from code 146
Using Other Documentation 148
Summary 149
Chapter 7: Getting Started with Interface Builder 151
Understanding IB 151
Understanding nib files 152
Using nib files 153
Getting Started with IB 156
Introducing key features of the editor 156
Viewing the template nib files 158
Introducing the utility area 159
Creating a Simple iOS Project with IB 163
Adding objects to a view 165
Setting object contents 167
Linking objects to code 176
Understanding the IB object hierarchy 186
Comparing IB in Xcode 4 with Xcode 3 188
Summary 188
Chapter 8: Creating More Advanced Effects with Interface Builder 189
Using File’s Owner and First Responder 189
Using File’s Owner 189
Using First Responder 191
Subclassing Views and Other Objects 193
Adding a new subclass in Xcode 194
Adding code to the subclass 196
Assigning the subclass in IB 198
Working with more advanced subclassing techniques 200
Creating Custom Objects 202
Creating Views with Static Images 202
Creating a colored background 203
Importing an image file 204
Assigning an image file 207
Supporting Non-English Languages 209
Working with Advanced IB Techniques 212
Using tags 212
Sending messages between nibs 213
Converting iPhone projects to the iPad 214
Summary 217
Part II: Going Deeper 219
Chapter 9: Saving Time in Xcode 221
Using Code Folding 221
Editing Structure 223
Refactoring Code 225
Using the Refactor menu 226
Using the Edit All In Scope feature 228
Using Code Snippets 229
Inserting a snippet 229
Creating a new snippet 230
Jumping to a Definition 232
Summary 233
Chapter 10: Using the Organizer 235
Working with Devices 235
Reviewing and managing profiles 237
Working with software images 239
Finding and installing iOS updates 240
Using device logs 241
Working with screenshots 244
Managing individual devices 246
Working with Projects and Archives 252
Managing Projects 252
Creating Archives 254
Summary 255
Chapter 11: Managing Certificates and Provisioning 257
Understanding Provisioning 257
Creating and Installing User Certificates 262
Creating a CSR 263
Uploading the CSR to the Provisioning Portal 265
Creating and downloading a development certificate 268
Creating and downloading a distribution certificate 268
Installing the certificates 269
Provisioning Devices Manually 271
Creating an App ID 272
Registering devices manually 277
Creating a Development Provisioning Profile 280
Creating a Distribution Provisioning Profile 283
Automatic Provisioning 285
Creating an automatic device profile 285
Refreshing a profile 286
Moving between Macs 287
Provisioning for OS X Distribution 288
Understanding OS X provisioning 289
Provisioning in practice 290
Summary 297
Chapter 12: Working with Builds, Schemes, and Workspaces 299
Getting Started with the Xcode Build System 299
Creating and organizing a workspace 301
Working with projects and targets 302
Understanding settings and options 304
Working with Schemes and Build Configurations 311
Getting started with build configurations 311
Understanding schemes 315
Editing schemes 316
Managing schemes, build actions, and targets 325
Summary 328
Chapter 13: Customizing Builds for Distribution and Advanced Development 329
Introducing Common Basic Customizations 329
Creating a build for testing and debugging 330
Selecting the Base SDK 330
Setting the minimum supported OS version 331
Including a framework or library in a build 336
Selecting a compiler 337
Controlling warnings 338
Disabling iOS PNG compression 339
Changing an app’s name before shipping 339
Creating App Store and Ad Hoc Builds 341
Building and packaging an iOS project for the App Store 341
Creating and distributing an iOS Ad Hoc build 357
Creating a Mac App Store submission 361
Working with Advanced Build Techniques 368
Understanding the build process 369
Introducing conditional compilation 370
Using conditional compilation 370
Understanding build phases and build rules 374
Working with build phases 374
Creating build rules 379
Summary 382
Chapter 14: Using Version Control 383
Using Manual Version Control 383
Using Snapshots 385
Working with Source Control 388
Understanding Git 389
Using Git locally 390
Using Xcode with GitHub 405
Summary 414
Part III: Creating Fast and Reliable Code 415
Chapter 15: Getting Started with Code Analysis and Debugging 417
Checking and Analyzing Code 418
Checking code as you enter it 418
Using Fix-It code tips 419
Using the Static Code Analyzer 420
Getting Started with Debugging 422
Using the Console 423
Creating custom messages 424
Using custom messages 425
Understanding crashes 426
Viewing multiple logs 429
Working with Breakpoints 430
Working with simple breakpoints 430
Using the Variables View 434
Using advanced breakpoint features 441
Working with Command-Line Debugging 446
Summary 448
Chapter 16: Testing Code with Instruments 449
Beginning with Instruments 450
Understanding Instruments 451
Exploring the Instruments UI 451
Getting Started with Instruments 458
Creating a leaky test app 459
Profiling an app with Instruments 460
Exploring the detail pane 475
Modifying instrument settings 476
Comparing different runs 479
Saving and loading runs 480
Working with Instruments and Templates 480
Understanding templates 480
Creating a template 480
Creating custom instruments 482
Working with UIAutomation 484
Setting up objects to support automation 485
Creating a test script 486
Getting started with Automation scripting 488
Summary 491
Chapter 17: Creating Unit Tests 493
Introducing Unit Testing 493
Understanding Unit Testing in Xcode 494
Creating a Simple Unit Test Project 496
Creating a new project that supports unit testing 497
Creating a class for testing 499
Creating a test case 502
Running tests 508
Summary 512
Part IV: Appendixes 513
Appendix A: Using Xcode’s Tools and Utilities 515
Appendix B: Working with Other Editors 527
Appendix C: Understanding Compiler Technology 549
Index 557