Home > Store

Step into Xcode: Mac OS X Development

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

Step into Xcode: Mac OS X Development

Book

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

Description

  • Copyright 2006
  • Edition: 1st
  • Book
  • ISBN-10: 0-321-33422-1
  • ISBN-13: 978-0-321-33422-0

A Step-by-Step Guide to the Xcode Mac OS Development Environment

Every copy of Mac OS X comes with Xcode, the powerful development suite that Apple uses to build applications ranging from Safari to iTunes. But because Xcode is complex and subtle, even experienced Mac programmers rarely take full advantage of it. Now, Mac developer Fritz Anderson has written the definitive introduction and guide to using Xcode to build applications with any Macintosh technology or language.

Anderson helps you master Xcode's powerful text editor, industry-standard gcc compiler, graphical interactive debugger, mature UI layout and object linkage editor, and exceptional optimization tools. One step at a time, you'll develop a command-line utility, then use Xcode tools to evolve it into a full-fledged Cocoa application. Anderson provides expert guidance on development frameworks, source code management, Core Data modeling, localization, and much more.

Coverage includes

  • Understanding Xcode workflow and the Mac OS X application lifecycle
  • Porting established legacy projects into Xcode
  • Using the Model-View-Controller design pattern to build robust graphical applications
  • Building static libraries and working with Xcode's build system
  • Making the most of bundles and package directories
  • Creating applications compatible with older versions of Mac OS X
  • Creating universal binaries to run on both Intel and PowerPC Macintoshes
  • Adding Spotlight searchability to data files
  • Leveraging Xcode's built-in support for unit testing
  • Using Xcode on makefile-based UNIX development projects

Step Into Xcode's breadth, depth, and practical focus make it indispensable to every Mac developer: current Xcode users upgrading to Xcode 2.1, experienced Mac programmers migrating from CodeWarrior, UNIX/Linux programmers moving to Mac OS X, and even novices writing their first programs or scripts.



Sample Content

Online Sample Chapter

A Cocoa Application: Views

Downloadable Sample Chapter

Download the Sample Chapter related to this title.

Table of Contents

Preface xvii

Part I The Life Cycle of a Mac OS X Application 1

1 Kicking the Tires 3

1.1 First Run 3

1.2 Hello, World 4

1.3 What Went Where 9

1.4 Summary 10

2 Simple Workflow and Passive Debugging 11

2.1 Linear Regression 11

2.2 Plan of Action 13

2.3 A Command Line Tool 14

2.4 Build Errors 15

2.5 Simple Debugging 18

2.6 Summary 21

3 Simple Active Debugging 23

3.1 The Next Step 23

3.2 Active Debugging 24

3.3 Summary 31

4 Compilation: The Basics 33

4.1 Compiling 33

4.2 Linking 36

4.3 Dynamic Loading 38

4.4 Prebinding 39

4.5 ZeroLink 40

4.6 Summary 42

5 Starting a Cocoa Application 43

5.1 Plan of Action 43

5.1.1 Program Tasks 43

5.1.2 Model-View-Controller 43

5.2 Starting a New Project 48

5.3 Implementation: Model 50

5.3.1 DataPoint 50

5.3.2 RegressionModel Class 54

5.3.3 Model: Done 58

5.4 Summary 60

6 A Cocoa Application: Views 61

6.1 Interface Builder 62

6.2 Layout 63

6.3 Sizing 67

6.4 A Split View 71

6.5 Summary 71

7 A Cocoa Application: Controllers 73

7.1 Still in Interface Builder 73

7.2 NSObjectController: Document 75

7.3 NSObjectController: Model 77

7.4 NSArrayController: DataPoints 78

7.5 Value Binding 80

7.6 Actions and Outlets 81

7.7 MyDocument 82

7.8 Application Properties 84

7.9 Building 87

7.10 Summary 87

8 Property Lists 89

8.1 Data Types 89

8.2 Property List Files 90

8.2.1 Writing a Property List 90

8.2.2 Examining Property Lists 100

8.3 Other Formats 106

8.3.1 ASCII Property Lists 106

8.3.2 Binary Property Lists 107

8.4 Text Macros 107

8.5 Summary 113

9 Libraries and Dependent Targets 115

9.1 Adding a Target 115

9.2 Library Design 116

9.3 Modifying Linear 121

9.4 A Dependent Target 123

9.5 Examining the Library 125

9.6 Running the Library 127

9.7 Summary 128

10 File Packages and Bundles 129

10.1 A Simple Package: RTFD 130

10.2 Bundles 132

10.3 Application Bundles 132

10.4 The Info.plist File 134

10.4.1 Keys for All Bundles 135

10.4.2 Keys for Applications 136

10.4.3 Keys for Plug-Ins 138

10.4.4 Keys for Java 139

10.4.5 Keys for Preference Panes 139

10.4.6 Keys for Dashboard Widgets 139

10.5 Summary 140

11 Creating a Custom View 141

11.1 Controller 141

11.2 View 143

11.3 The Delegate Design Pattern 146

11.4 The Custom View 149

11.5 Showing the Window 156

11.6 Testing 157

11.7 Debugging a View 159

11.8 Summary 163

12 Dynamic Libraries and Frameworks 165

12.1 Adding a Framework Target 166

12.2 Framework Structure 171

12.3 Using the Framework 173

12.4 Where Frameworks Go 175

12.5 Private Frameworks 179

12.6 Prebinding 181

12.7 Summary 182

13 Version Control 183

13.1 Setting up a Repository 185

13.2 Controlling Linear 191

13.3 Long Live Linear 194

13.4 Tagging 195

13.5 Summary 198

14 Cross-Development 199

14.1 Cross-Development SDKs 199

14.2 Nib Compatibility 203

14.3 NSTableDataSource 205

14.4 Add, Remove, Compute, and Graph Buttons 208

14.5 Run and Archive 211

14.6 A More Sophisticated Approach 212

14.7 Producing a Universal Binary 212

14.7.1 Auditing for Portability 213

14.7.2 Auditing Linear 214

14.7.3 Building Universal 217

14.7.4 Mixing SDKs 218

14.8 Summary 219

15 Using the Data Modeling Tools 221

15.1 Data Modeling 221

15.2 Revisiting the Model 224

15.2.1 DataPoint 225

15.2.2 Regression 228

15.2.3 MyDocument 232

15.3 Interface Builder 234

15.4 Build and Run 235

15.5 Adding an Entity 237

15.5.1 Adding to the Data Model 237

15.5.2 Human Interface 238

15.5.3 First Run 240

15.5.4 One More Table 241

15.6 Summary 242

16 Spotlight 243

16.1 How Data Gets into Spotlight 243

16.2 Uniform Type Identifiers 246

16.3 The Metadata Plug-In 249

16.3.1 MetaLinear Project Files 249

16.3.2 Packaging the Plug-In 254

16.4 Core Data and Metadata 254

16.5 The Proof of the Pudding 258

16.6 Summary 261

17 Finishing Touches 263

17.2 Avoiding Singularity 264

17.3 Localization 266

17.3.1 Credits.rtf 266

17.3.2 MainMenu.nib 267

17.3.3 MyDocument.nib 267

17.3.4 GraphWindow.nib 269

17.3.5 InfoPlist.strings 270

17.3.6 Trying It Out 271

17.3.7 Localizable.strings 272

17.4 Checking Memory Usage 274

17.5 The Release Build Configuration 276

17.6 Dead-Code Stripping 278

17.7 xcodebuild 279

17.8 Summary 281

Part II Xcode Tasks 283

18 Navigating an Xcode Project 285

18.1 Editor Panes 285

18.1.1 Jumps 285

18.1.2 Code Sense 286

18.1.3 Navigation Bar 287

18.1.4 Editor Modes 289

18.2 Project Find Window 290

18.3 The Favorites Bar 291

18.4 Groups & Files List 292

18.4.1 The Project Group 292

18.4.2 The Targets Group 294

18.4.3 The Executables Group 296

18.4.4 Smart Groups 297

18.4.5 Symbol Smart Group 298

18.5 Class Browser Window 299

18.6 Class Modeler 299

18.7 Project Layout 302

18.7.1 Default Layout 302

18.7.2 All-in-One Layout 303

18.7.3 Condensed Layout 305

18.8 Summary 306

19 Xcode for CodeWarrior Veterans 307

19.1 Losses 307

19.1.1 Speed 307

19.1.2 Syntax Coloring 308

19.1.3 Debugging Templates 308

19.1.4 RAD Tools 309

19.2 Make Yourself at Home 309

19.2.1 The Project Window 309

19.2.2 Key Mapping 311

19.2.3 Build Behavior 312

19.2.4 Window Behavior 313

19.3 Converting a CodeWarrior Project 314

19.3.1 Importing the Project 315

19.3.2 Targets and Configurations 315

19.4 Traps in Conversion 319

19.5 Exporting Symbols 320

19.5.1 #pragma export 320

19.5.2 Another Way 322

19.6 Summary 323

20 Xcode for make Veterans 325

20.1 Xcode Build Variables 327

20.2 Custom Build Rules 328

20.3 Run Script Build Phase 330

20.4 Under the Hood: A Simple Build 331

20.4.1 Copy Structural Files 332

20.4.2 Copy Bundle Resources 333

20.4.3 Compile Sources 333

20.4.4 Linkage (First Architecture) 336

20.4.5 Compile Sources (Second Architecture) 336

20.4.6 Linkage (Second Architecture) 337

20.4.7 Create Universal Binary 337

20.4.8 Compile Data Models 338

20.4.9 Finishing Touch 339

20.5 The xcode build Tool 339

20.6 Settings Hierarchy 340

20.7 Build Configurations 342

20.8 Summary 344

21 More About Debugging 345

21.1 Debugging Techniques 345

21.2 Printing Values 348

21.3 Custom Formatters 349

21.4 Breakpoint Commands 352

21.5 Breakpoint Conditions 354

21.6 Lazy Symbol Loading 355

21.7 Zombies 356

21.7.1 Released-Pointer Aliasing 357

21.7.2 Zombies in Cocoa 359

21.7.3 Zombies in Core Foundation 360

21.8 Summary 361

22 Xcode and Speed 363

22.1 Precompiled Headers 363

22.2 Predictive Compilation 364

22.3 Distributed Builds 365

22.4 ZeroLink 366

22.5 Profect Indexing 367

22.6 Summary 368

23 AppleScript Studio 369

23.1 An AppleScript Application 369

23.2 Unit Testing 377

23.2.1 Adding OC Unit 378

23.2.2 Test Cases 379

23.2.3 Testing Options 383

23.3 Summary 383

24 A Large Project 385

24.1 Graphviz 386

24.2 Preparing the Project 386

24.3 An External Build Project 389

24.4 Debugging a Custom Executable 393

24.5 Performance 396

24.6 A Better Way to Include Files 400

24.6.1 The Script 401

24.6.2 Building the Project Index 404

24.6.3 Compromising with AppleScript 405

24.7 Summary 405

25 Closing Snippets 407

25.1 Miscellaneous Traps 407

25.2 Miscellaneous Tips 409

25.3 Documentation 413

25.3.1 The Documentation Window 414

25.3.2 Documentation Updates 416

Appendix A Installing Xcode 417

A.1 Apple Developer Connection 419

A.1.1 Downloading from ADC 420

A.2 Setting up the Dock 420

Appendix B Some Build Variables 423

B.1 Useful Build Variables 423

B.2 Splitting Build Variables 429

B.3 Source Trees 430

Glossary 433

Index 441



Index

Download the Index file related to this title.

Updates

Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

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

Overview


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

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

Collection and Use of Information


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

Questions and Inquiries

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

Online Store

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

Surveys

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

Contests and Drawings

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

Newsletters

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

Service Announcements

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

Customer Service

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

Other Collection and Use of Information


Application and System Logs

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

Web Analytics

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

Cookies and Related Technologies

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

Do Not Track

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

Security


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

Children


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

Marketing


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

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

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

Correcting/Updating Personal Information


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

Choice/Opt-out


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

Sale of Personal Information


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

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

Supplemental Privacy Statement for California Residents


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

Sharing and Disclosure


Pearson may disclose personal information, as follows:

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

Links


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

Requests and Contact


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

Changes to this Privacy Notice


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

Last Update: November 17, 2020