Xcode 3 Unleashed

Book description

Apple’s new Xcode 3 is the most powerful Mac development suite ever created. In Xcode 3 Unleashed, renowned Mac developer Fritz Anderson has written the definitive guide to making the most of Xcode 3 to build any Macintosh or iPhone application.

Anderson leads you through a simple project that covers the entire Xcode 3.x development lifecycle. You’ll walk through building and debugging command-line tools, creating Mac OS X user interfaces, modeling data, localizing languages, compiling applications, and much more. Along the way, he introduces each of Apple’s remarkable development tools from the latest version of Interface Builder to Instruments—a powerful new tool for analyzing and optimizing your code.

Anderson shows how to manage your source code in any environment, whether you’re working solo or participating in a worldwide team. He thoroughly illuminates Xcode 3’s build system and shows how to make the most of Apple’s performance tools, led by the deep and powerful Shark statistical profiler.

Systematically updated for Xcode 3.x, this is a comprehensive revision of Anderson’s previous bestseller, Step into Xcode. Its breadth, depth, and practical focus will make it indispensable to every Mac developer: experienced programmers upgrading from Xcode 2 or migrating from CodeWarrior; UNIX/Linux programmers moving to Mac OS X; even new programmers.

Detailed information on how to…

  • Succeed with every stage of the Mac OS X application lifecycle

  • Make the most of Xcode 3’s core tools for editing, debugging, testing, and compilation

  • Get the most from new improvements to Interface Builder

  • Create robust applications using the Model-View-Controller paradigm

  • Utilize dynamic libraries and frameworks

  • Build Universal Binaries to run on both Intel and PowerPC Macs

  • Add Spotlight searchability to data files

  • Profile memory, I/O, graphics, and threading in real-time

  • Accelerate both your applications and your development processes

  • Leverage new improvements to the Xcode documentation system

  • Avoid header ambiguity, disappearing links, and other Xcode development pitfalls

  • Introduction 1

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

    Chapter 1: Kicking the Tires 11

    Chapter 2: Simple Workflow and Passive Debugging 19

    Chapter 3: Simple Active Debugging 29

    Chapter 4: Compilation: The Basics 39

    Chapter 5: Starting a Cocoa Application 47

    Chapter 6: A Cocoa Application: Views 63

    Chapter 7: A Cocoa Application: Controllers 75

    Chapter 8: Version Control 93

    Chapter 9: Property Lists 117

    Chapter 10: Libraries and Dependent Targets 141

    Chapter 11: File Packages and Bundles 153

    Chapter 12: Unit Testing 167

    Chapter 13: Creating a Custom View 181

    Chapter 14: Dynamic Libraries and Frameworks 203

    Chapter 15: Documentation in Xcode 221

    Chapter 16: Using the Data Modeling Tools 243

    Chapter 17: Cross-Development 267

    Chapter 18: Spotlight (or, How to Build a Plug-in) 281

    Chapter 19: Finishing Touches 301

    Part II: Xcode Tasks

    Chapter 20: Navigating an Xcode Project 331

    Chapter 21: Xcode for make Veterans 353

    Chapter 22: More About Debugging 373

    Chapter 23: Xcode and Speed 395

    Chapter 24: A Legacy Project 403

    Chapter 25: Shark and the CHUD Tools 421

    Chapter 26: Instruments 437

    Chapter 27: Closing Snippets 461

    Appendices

    Appendix A: Some Build Variables 475

    Appendix B: Project and Target Templates 485

    Appendix C: Other Resources 501

    Index 507

    Table of contents

    1. Copyright
      1. Dedication
    2. Praise for Xcode 3 Unleashed
    3. Preface
      1. Version Covered
      2. Typographic Conventions
    4. About the Author
    5. Acknowledgments
    6. We Want to Hear from You!
      1. Reader Services
    7. Introduction
      1. What’s New in Xcode 3
      2. Obtaining Xcode
        1. Downloading Xcode
      3. Installing Xcode
        1. Another Install Location
      4. Uninstalling Xcode
      5. Xcode 2.5
    8. I. The Life Cycle of a Mac OS X Application
      1. 1. Kicking the Tires
        1. First Run
        2. Hello, World
        3. What Went Where
        4. Summary
      2. 2. Simple Workflow and Passive Debugging
        1. Calculating a Linear Regression
        2. Plan of Action
        3. A Command-Line Tool
        4. Build Errors
        5. Simple Debugging
        6. Summary
      3. 3. Simple Active Debugging
        1. The Next Step
        2. Active Debugging
        3. Summary
      4. 4. Compilation: The Basics
        1. Compiling
        2. Linking
        3. Dynamic Loading
        4. Legacy Technologies
          1. Prebinding
          2. ZeroLink
        5. Summary
      5. 5. Starting a Cocoa Application
        1. Plan of Action
          1. Program Tasks
          2. Model-View-Controller
          3. The Model
          4. The Controller
          5. The Views
        2. Starting a New Project
          1. Adding Linrg
        3. Implementation: Model
          1. DataPoint Model Class
          2. Regression Model Class
          3. Model: Done
        4. Summary
      6. 6. A Cocoa Application: Views
        1. Interface Builder
          1. Layout
          2. Sizing
          3. A Split View
        2. Summary
      7. 7. A Cocoa Application: Controllers
        1. The Next Step
        2. Adding a Controller
          1. NSObjectController: Document
          2. NSObjectController: Model
          3. NSArrayController: DataPoints
        3. Value Binding
        4. Actions and Outlets
        5. MyDocument
        6. Application Properties
        7. Building
        8. Summary
      8. 8. Version Control
        1. Setting Up a Repository
        2. Getting Ready for Subversion
        3. Telling Xcode About a Repository
        4. Controlling Linear
        5. Getting a Controlled Linear
        6. Revising
        7. Rolling Back
        8. Tagging
        9. Summary
      9. 9. Property Lists
        1. Data Types
        2. Property List Files
          1. Writing a Property List
            1. Model
            2. View
            3. Controller
        3. Examining Property Lists
          1. As Text
          2. Property List Editor
        4. Other Formats
          1. ASCII Property Lists
          2. Binary Property Lists
        5. Text Macros
        6. Summary
      10. 10. Libraries and Dependent Targets
        1. Adding a Target
        2. Library Design
        3. Modifying Linear
        4. A Dependent Target
        5. Examining the Library
        6. Running the Library
        7. Summary
      11. 11. File Packages and Bundles
        1. A Simple Package: RTFD
        2. Bundles
        3. Application Bundles
        4. The Info.plist File
          1. Keys for All Bundles
          2. Keys for Applications
          3. Keys for Plug-Ins
          4. Keys for Java
          5. Keys for Preference Panes
          6. Keys for Dashboard Widgets
        5. Summary
      12. 12. Unit Testing
        1. Adding a Unit Test Target
        2. Refactoring
        3. Running the Tests
        4. A Dependent Test
        5. Crossing Architectures
        6. Summary
      13. 13. Creating a Custom View
        1. Controller
        2. View
        3. The Delegate Design Pattern
        4. The Custom View
        5. Showing the Window
        6. Testing
        7. Debugging a View
        8. Summary
      14. 14. Dynamic Libraries and Frameworks
        1. Adding a Framework Target
          1. Info.plist
          2. Assigning Files
        2. Framework Structure
        3. Using the Framework
        4. Where Frameworks Go
          1. A Public Framework
          2. A Private Framework
        5. Summary
      15. 15. Documentation in Xcode
        1. HeaderDoc
        2. User Scripts in Xcode
        3. DocSets
          1. Preparing the Workspace
          2. The Least We Can Do
        4. Shell Script Targets
        5. Browsing
        6. API Documentation
        7. Summary
      16. 16. Using the Data Modeling Tools
        1. Data Modeling
        2. Revisiting the Model
          1. DataPoint
          2. All DataPoints
          3. Initializers
          4. Accessors
          5. Regression
          6. MyDocument
        3. Interface Builder
        4. Build and Run
        5. Adding an Entity
          1. Adding to the Data Model
          2. Human Interface
          3. First Run
          4. One More Table
        6. Summary
      17. 17. Cross-Development
        1. Cross-Development SDKs
        2. Weak Linking
        3. NIB Compatibility
        4. Universal Binaries
          1. Auditing Linear
          2. Testing
        5. Building for Different Operating Systems on Different Processors
        6. Project Compatibility
        7. Summary
      18. 18. Spotlight (or, How to Build a Plug-in)
        1. How Data Gets into Spotlight
        2. Uniform Type Identifiers
        3. The Spotlight Plug-In
          1. The MetaLinear Project
          2. MetaLinear Project Files
            1. Info.plist
            2. schema.xml
            3. schema.strings
            4. GetMetadataForFile.c
          3. Packaging the Plug-In
          4. Checking Our Work
        4. Core Data and Metadata
        5. The Proof of the Pudding
        6. Summary
      19. 19. Finishing Touches
        1. Trimming the Menus
          1. Avoiding Singularity
        2. Localization
          1. Credits.rtf
          2. MainMenu.nib
          3. MyDocument.nib
          4. GraphWindow.xib
          5. InfoPlist.strings
          6. Trying It Out
          7. Localizable.strings
        3. Checking Memory Usage
        4. Instruments
          1. Leaked Blocks
          2. Leaky Call Trees
          3. The ObjectAlloc Instrument
          4. The Instruments Document
          5. Human-Interface Logging
        5. The Release Build Configuration
        6. Stripping the Product
          1. Stripping the Symbol Table
          2. Stripping Dead Code
        7. Summary
    9. II. Xcode Tasks
      1. 20. Navigating an Xcode Project
        1. Editor Panes
          1. Code Sense
          2. Jumps
          3. The Navigation Bar
          4. Code Focus
          5. The Debugger Strip
          6. Editor Modes
        2. Project Find Window
        3. The Favorites Bar
        4. Groups & Files List
          1. The Project Group
        5. The Targets Group
          1. The Executables Group
          2. Smart Groups
          3. Symbol Smart Group
        6. Class Browser Window
        7. Class Modeler
        8. Project Layout
          1. Default Layout
            1. Build Results
            2. Console
            3. SCM Results
          2. All-in-One Layout
            1. Editing
            2. Debugging
          3. Condensed Layout
        9. Summary
      2. 21. Xcode for make Veterans
        1. Xcode Build Variables
        2. Custom Build Rules
        3. Run Script Build Phase
        4. Under the Hood: A Simple Build
          1. Copy Structural Files
          2. Compile XIB
          3. Run Script
          4. Copy Bundle Resources
          5. Compile Sources
          6. Linkage (First Architecture)
          7. Compile Sources (Second Architecture)
          8. Linkage (Second Architecture)
          9. Compile Data Models
          10. Create Universal Binary
          11. Finishing Touch
        5. The xcodebuild Tool
        6. Settings Hierarchy
        7. Build Configurations
        8. Summary
      3. 22. More About Debugging
        1. Debugging Techniques
        2. Printing Values
        3. Custom Formatters
        4. Breakpoint Commands
        5. Breakpoint Conditions
        6. Lazy Symbol Loading
        7. Zombies
          1. Released-Pointer Aliasing
          2. NSZombieEnabled
        8. The Mini Debugger, and the In-Editor Debugger
        9. Datatips
        10. Summary
          1. Further Reading
      4. 23. Xcode and Speed
        1. Precompiled Headers
        2. Predictive Compilation
        3. Distributed Builds
          1. All Distributed Builds
          2. Shared Workgroup Builds
          3. Dedicated Network Builds
        4. Project Indexing
        5. Summary
      5. 24. A Legacy Project
        1. Preparing the Project
        2. The Organizer
          1. The Files List
          2. The Organizer Toolbar
          3. Configure and Build
          4. Installing
          5. Running
        3. An External Build System Project
          1. Code Sense Is Here
          2. Running
          3. Debugging
          4. The Limits of the External Build System
        4. Summary
      6. 25. Shark and the CHUD Tools
        1. Shark
          1. The Problem
          2. Starting Shark
          3. Analysis
          4. The Top-Down View
          5. Mining the Call Stack
          6. Measure, Then Optimize
          7. The Effect
        2. The Other Performance Tools
          1. BigTop
          2. Reggie SE
          3. SpindownHD
          4. Saturn
          5. MallocDebug
          6. ObjectAlloc and Sampler
          7. Quartz Debug
          8. Spin Control
          9. Thread Viewer
          10. CHUD Remover
        3. Summary
      7. 26. Instruments
        1. What Instruments Is
        2. Running Instruments
        3. The Trace Document Window
          1. The Toolbar
          2. The Track Pane
          3. The Detail Pane
          4. The Extended Detail Pane
          5. Controls
        4. The Library
        5. Running an Instrument
          1. Instrument Configuration
          2. Recording
          3. Saving and Reopening
        6. The Instruments
          1. Core Data
            1. Core Data Saves
            2. Core Data Fetches
            3. Core Data Faults
            4. Core Data Cache Misses
          2. File System
            1. File Locks
            2. File Attributes
            3. File Activity
            4. Directory I/O
          3. Garbage Collection
            1. GC Total
            2. Garbage Collection
          4. Graphics
            1. OpenGL Driver
          5. Input / Output
            1. Reads / Writes
          6. Master Track
            1. User Interface
          7. Memory
            1. Shared Memory
            2. ObjectAlloc
            3. Leaks
          8. System
            1. Activity Monitor
            2. Sampler
            3. Spin Monitor
            4. Process
            5. Network Activity Monitor
            6. Memory Monitor
            7. Disk Monitor
            8. CPU Monitor
          9. Threads/Locks
            1. JavaThread
          10. User Interface
            1. Cocoa Events
            2. Carbon Events
        7. Custom Instruments
        8. The Templates
        9. Summary
      8. 27. Closing Snippets
        1. Miscellaneous Traps
        2. Miscellaneous Tips
        3. More Documentation
          1. Documentation Set Updates
          2. Boolean Text Searches
    10. III. Appendices
      1. A. Some Build Variables
        1. Useful Build Variables
          1. Environment
          2. Build Targets
          3. Source Locations
          4. Destination Locations
          5. Bundle Locations
          6. Compiler Settings
          7. Search Paths
          8. Deployment
        2. Source Trees
      2. B. Project and Target Templates
        1. Project Templates
          1. The Empty Project
          2. Action
          3. Application
          4. Audio Units
          5. Bundle
          6. Command-Line Utility
          7. Dynamic Library
          8. External Build System
          9. Framework
          10. Java
          11. Kernel Extension
          12. Standard Apple Plug-Ins
          13. Static Library
        2. Target Templates
          1. BSD
          2. Carbon
          3. Cocoa
          4. Java
          5. Kernel Extension
          6. Ruby
          7. Special Targets
        3. Legacy Targets
          1. Cocoa
          2. Java
          3. Kernel Extension
      3. C. Other Resources
        1. Books
        2. From the Xcode Documentation Window
        3. On the Net
          1. Mailing Lists
          2. Usenet
          3. Sites and Logs
        4. Face to Face
        5. Text Editors
        6. Tools

    Product information

    • Title: Xcode 3 Unleashed
    • Author(s):
    • Release date: July 2008
    • Publisher(s): Sams
    • ISBN: 9780768682939