Home > Store > Programming > C/C++

larger cover

Add To My Wish List

Objective-C Phrasebook

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

  • Description
  • Downloads
  • Extras
  • Reviews
  • Sample Content

Product Author Bios

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).

Objective-C Phrasebook gives you the code phrases you need to quickly and effectively complete your programming projects with Objective-C, on systems including iOS and Mac OS X.

 

Concise and Accessible

Easy to carry and easy to use–lets you ditch all those bulky books for one portable pocket guide

 

Flexible and Functional

Packed with more than 100 customizable code snippets–so you can readily code elegant Objective-C in just about any situation

Example(s)

Download the Example Files from this book.

Customer Reviews

9 of 10 people found the following review helpful
5.0 out of 5 stars Developing in Objective-C just got easier, February 12, 2011
This review is from: Objective-C Phrasebook (Developer's Library) (Paperback)
I've been developing in Objective-C for years and teach classes at a local college. However there are many times while coding that I need to look at old code or documentation for even the simplest tasks. You just can't remember every Objective-C class or their method calls. That is where the Objective-C Phrasebook comes in handy. The book won't teach you everything about Objective-C, but it will take a task, show the code and then explain it's function. It will even explain some of the gotcha's as well. If you own Sadun's Developer's Cookbook, then this book should be on your shelf also (or right next to your Mac). More so if you don't have the Cookbook. For those new to developing iPhone and Mac applications, you will find this book invaluable and will help you code and understand quicker. Two thumbs up and 5 stars.
Help other customers find the most helpful reviews 
Was this review helpful to you? Yes No


13 of 17 people found the following review helpful
3.0 out of 5 stars Good if you're interested in GNUStep, March 3, 2011
This review is from: Objective-C Phrasebook (Developer's Library) (Paperback)
Objective-C is the language of MacOS and iOS: practically no other system uses it. There is, however, an exception: GNUStep. GNUStep is an open source implementation of Cocoa, and if you're at all interested in GNUStep, I would highly recommend this book: this book does a good job of pointing out where Cocoa and GNUStep diverge and why. If you're mostly interested in Cocoa, I'd recommend starting somewhere else though.

When I got this book, I was expecting something along the lines of "Effective Java" or "Effective C++": books that I use frequently because they contain advice on how to make the best use of the language and how to avoid pitfalls that you might not expect if you're unfamiliar with the language.

Unlike those books, the Objective-C Phrasebook doesn't assume any prior knowledge with Objective-C and its scope is therefore necessarily limited to the basics. I found that disappointing: important features of Cocoa, such as the run loop and memory... Read more
Help other customers find the most helpful reviews 
Was this review helpful to you? Yes No


5 of 6 people found the following review helpful
5.0 out of 5 stars Two thumbs up!, February 22, 2011
This review is from: Objective-C Phrasebook (Developer's Library) (Paperback)
I have been developing for iOS now for just under two years and have a couple of apps in the app store that I fought with tooth and nail. Even though I am only half way through, Objective-C Phrasebook has already earned a place next to my other Objective-C texts. Its treatment of the idioms used when developing with Objective-C could have saved me lots of time during development and I have learned a lot already. I am looking forward to the meat of the text in the later chapters on Blocks, Threads, and Notifications. Two thumbs up!
Help other customers find the most helpful reviews 
Was this review helpful to you? Yes No


Share your thoughts with other customers:
 See all 12 customer reviews...

Online Sample Chapter

Objective-C Phrasebook: Numbers

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

Sample Pages

Download the sample pages (includes Chapter 5 and Index)

 
Best Value

Book + eBook Bundle  $53.98  $32.39

Book Price $23.99
eBook Price $8.40
eBook formats included

Buy

This book includes free shipping!

Buy

Book  $29.99  $23.99

Usually ships in 24 hours.

This book includes free shipping!

Buy

eBook (Watermarked)  $23.99  $19.19

Includes EPUB, MOBI, and PDF
About eBook Formats

This eBook includes the following formats, accessible from your Account page after purchase:

ePubEPUBThe open industry format known for its reflowable content and usability on supported mobile devices.

MOBIMOBIThe eBook format compatible with the Amazon Kindle and Amazon Kindle applications.

Adobe ReaderPDFThe popular standard, used most often with the free Adobe® Reader® software.

This eBook requires no passwords or activation to read. We customize your eBook by discretely watermarking it with your name, making it uniquely yours.

Purchase Reward: One Month Free Subscription
By completing any purchase on InformIT, you become eligible for an unlimited access one-month subscription to Safari Books Online.

Get access to thousands of books and training videos about technology, professional development and digital media from more than 40 leading publishers, including Addison-Wesley, Prentice Hall, Cisco Press, IBM Press, O'Reilly Media, Wrox, Apress, and many more. If you continue your subscription after your 30-day trial, you can receive 30% off a monthly subscription to the Safari Library for up to 12 months. That's a total savings of $199.