This is the eBook version of the printed book.

A concise, practical guide to Objective-C for iOS and Mac OS X with more than 100 useful code snippets and programming phrases

Packed with more instantly useful code snippets and programming techniques than any other Objective-C reference
More programmers than ever are finding they need to learn at least some Objective-C in ...

See more details below
Objective-C Phrasebook

Available on NOOK devices and apps  
  • NOOK Devices
  • Samsung Galaxy Tab 4 NOOK 7.0
  • Samsung Galaxy Tab 4 NOOK 10.1
  • NOOK HD Tablet
  • NOOK HD+ Tablet
  • NOOK eReaders
  • NOOK Color
  • NOOK Tablet
  • Tablet/Phone
  • NOOK for Windows 8 Tablet
  • NOOK for iOS
  • NOOK for Android
  • NOOK Kids for iPad
  • PC/Mac
  • NOOK for Windows 8
  • NOOK for PC
  • NOOK for Mac

Want a NOOK? Explore Now

NOOK Book (eBook)
BN.com price
(Save 43%)$23.99 List Price


This is the eBook version of the printed book.

A concise, practical guide to Objective-C for iOS and Mac OS X with more than 100 useful code snippets and programming phrases

Packed with more instantly useful code snippets and programming techniques than any other Objective-C reference
More programmers than ever are finding they need to learn at least some Objective-C in order to be able to develop iOS apps for iPhone or iPad
Objective-C is the native programming language for Mac OS X Snow Leopard, with more than 40 million users

Read More Show Less

Product Details

  • ISBN-13: 9780132486545
  • Publisher: Pearson Education
  • Publication date: 2/8/2011
  • Series: Developer's Library
  • Sold by: Barnes & Noble
  • Format: eBook
  • Edition number: 1
  • Pages: 350
  • File size: 7 MB

Meet the Author

David Chisnall is an active contributor to the GNUstep project, which provides an open source implementation of the Cocoa APIs, and cofounded the Étoilé project to build a desktop environment atop GNUstep. He has created a new Objective-C runtime library, worked on Objective-C support in the clang compiler, and published papers on Objective-C. He is the author of Cocoa Programming Developer’s Handbook (Addison-Wesley, 2009).

Read More Show Less

Table of Contents

Introduction xiv

1 The Objective-C Philosophy 1

Understanding the Object Model 2

A Tale of Two Type Systems 4

C Is Objective-C 5

The Language and the Library 7

The History of Objective-C 9

Cross-Platform Support 12

Compiling Objective-C Programs 14

2 An Objective-C Primer 17

Declaring Objective-C Types 18

Sending Messages 22

Understanding Selectors 26

Declaring Classes 28

Using Protocols 33

Adding Methods to a Class 35

Using Informal Protocols 38

Synthesizing Methods with Declared Properties 39

Understanding self, _cmd, super 44

Understanding the isa Pointer 47

Initializing Classes 50

Reading Type Encodings 53

Using Closures 56

3 Memory Management 59

Retaining and Releasing 60

Assigning to Instance Variables 61

Avoiding Retain Cycles 63

Autorelease Pools 64

Using Autoreleased Constructors 66

Autoreleasing Objects in Accessors 67

Supporting Automatic Garbage Collection 68

Interoperating with C 70

Using Weak References 71

Allocating Scanned Memory 73

4 Common Objective-C Patterns 75

Supporting Two-Stage Creation 76

Copying Objects 78

Archiving Objects 80

Creating Designated Initializers 84

Enforcing the Singleton Pattern 87

Delegation 89

Providing Façades 91

Creating Class Clusters 93

Using Run Loops 96

5 Numbers 99

Storing Numbers in Collections 101

Performing Decimal Arithmetic 105

Converting Between Strings and Numbers 108

Reading Numbers from Strings 110

6 Manipulating Strings 113

Creating Constant Strings 114

Comparing Strings 115

Processing a String One Character at a Time 119

Converting String Encodings 122

Trimming Strings 125

Splitting Strings 126

Copying Strings 128

Creating Strings from Templates 130

Storing Rich Text 133

7 Working with Collections 135

Using Arrays 137

Manipulating Indexes 139

Storing Unordered Groups of Objects 141

Creating a Dictionary 143

Iterating Over a Collection 145

Finding an Object in a Collection 149

Subclassing Collections 152

8 Dates and Times 157

Finding the Current Date 158

Converting Dates for Display 160

Calculating Elapsed Time 163

Parsing Dates from Strings 165

Receiving Timer Events 166

9 Working with Property Lists 169

Storing Collections in Property Lists 170

Reading Data from Property Lists 173

Converting Property List Formats 176

Storing User Defaults 178

Storing Arbitrary Objects in User Defaults 182

10 Interacting with the Environment 185

Getting Environment Variables 186

Parsing Command-Line Arguments 188

Accessing the User’s Locale 190

Supporting Sudden Termination 191

11 Key-Value Coding 195

Accessing Values by Key 196

Ensuring KVC Compliance 197

Understanding Key Paths 201

Observing Keys 203

Ensuring KVO Compliance 205

12 Handling Errors 209

Runtime Differences for Exceptions 210

Throwing and Catching Exceptions 214

Using Exception Objects 216

Managing Memory with Exceptions 218

Passing Error Delegates 221

Returning Error Values 222

Using NSError 223

13 Accessing Directories and Files 227

Reading a File 228

Moving and Copying Files 230

Getting File Attributes 232

Manipulating Paths 234

Determining if a File or Directory Exists 236

Working with Bundles 238

Finding Files in System Locations 240

14 Threads 245

Creating Threads 246

Controlling Thread Priority 247

Synchronizing Threads 250

Storing Thread-Specific Data 252

Waiting for a Condition 255

15 Blocks and Grand Central 259

Binding Variables to Blocks 260

Managing Memory with Blocks 264

Performing Actions in the Background 267

Creating Custom Work Queues 269

16 Notifications 273

Requesting Notifications 274

Sending Notifications 276

Enqueuing Notifications 277

Sending Notifications Between Applications 278

17 Network Access 283

Wrapping C Sockets 284

Connecting to Servers 286

Sharing Objects Over a Network 289

Finding Network Peers 292

18 Debugging Objective-C 297

Inspecting Objects 298

Recognizing Memory Problems 300

Watching Exceptions 302

Asserting Expectations 304

Logging Debug Messages 306

19 The Objective-C Runtime 309

Sending Messages by Name 310

Finding Classes by Name 312

Testing If an Object Understands a Method 313

Forwarding Messages 315

Finding Classes 318

Inspecting Classes 320

Creating New Classes 322

Index 325

Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously

    If you find inappropriate content, please report it to Barnes & Noble
    Why is this product inappropriate?
    Comments (optional)