Index

A

ABI. See Application Binary Interface (ABI)

abstract base class

hiding implementation detail, 4247

immutable and mutable arrays, 45

subclasses inheriting from class cluster, 46

ACAccountStoreBooleanCompletionHandler type, 196

accessor methods

automatically writing, 25, 2829

autosynthesis, 2829

categories, 131

fine-grained control over, 31

instance variables, 34, 227

locking for atomicity, 2930, 32

names, 31

preventing synthesis, 29

strict naming patterns, 27

user-implemented, 29

Accounts framework, 196

addFriend: method, 94, 126

addObject: method, 149

addOperationWithBlock: method, 218

alerts, 4850

alertView parameter, 49

allObjects method, 237

alloc method, 149, 151, 153154

AND operator, 19

animation, 235

anInstanceMethod method, 190

anonymous objects and protocols, 140142

APIs

C-level, 235

completion callback blocks, 205206

AppKit framework, 82, 235

Application Binary Interface (ABI), 27

applications, 2

controlling high memory, 174

multithreaded, 187

not linking, 7374

terminating when main threads blocked, 197

applicationWillTerminate: method, 163

ARC. See Automatic Reference Counting (ARC)

arguments and messages, 50

arrays, 243

adding number object, 149

binning objects with hash, 38

block-based enumeration, 189, 240241

common methods for, 45

defining interface to, 46

enumerating, 236238

immutable, 12, 45

indexes, 9, 12, 241

literals, 910

mutable, 45

nil objects and exceptions, 910

placeholder arrays, 45

reversing enumeration, 240

size of, 243

arrayWithObjects: method, 10

assign attribute, 30, 171

associated objects

attaching custom data to classes, 4750

categories, 131

keys, 48

usage example, 4850

associations, 47

asynchronous dispatch, 210

asynchronous methods, 197198

atomic attribute, 32

atomic locking and accessor methods, 2930

atomic properties, 208209

attributes

memory-management semantic, 91

properties, 2933

audio hardware, C-level API for interfacing with, 234235

audio playback and recording, 235

AudioToolbox framework, 74

autoDictionaryGetter function, 6061

autoDictionarySetter function, 60, 61

Automatic Reference Counting (ARC), xiii, 108

backward compatibility, 156

cleanup code during deallocation, 160

code not compiling, 145, 149

destroying objects, 167

exceptions, 105

extraneous autorelease plus immediate retain, 157158

instance variables, 159, 160161

lower-level C methods, 154

memory management, 154156

memory-management rules, 214

memory-management semantics of variables, 158161

message dispatch and, 161

method-naming rules, 154158

Objective-C objects, 231, 235, 244

optimizations, 156, 161

ownership of objects, 244

reference counting and, 153161

retainCount method, 183184

retains and releases, 154156

runtime component, 156

safely handling exceptions, 167

variables retaining value, 158159

writing setter, 159

autonilling, 117

autorelease method, 146, 150151, 154, 156157, 184

autorelease pools, 146, 150151, 185

draining, 151

nesting, 174175

overhead, 176

reducing high memory waterline, 173177

scope, 174

stack, 175

temporary objects, 174175

threads, 173

autoreleases, collapsing, 156

@autorelease syntax, 176

__autoreleasing qualifier, 159

autosynthesis, 2829

AVFoundation framework, 235

B

backward compatibility and Auto-matic Reference Counting (ARC), 156

barrier feature, 211

base class

defining, 43

inheritance, 4243, 140142

instances, 45

beginContentAccess method, 251252

bitfield data type, 121122

bitwise AND operator, 19

bitwise OR operator, 19, 22, 23

block-based enumeration, 240243

changing method signature to limit need for casting, 241242

versus for loops, 236243

reversing, 242

stopping, 241

__block qualifier, 189

blocks, xiii, 187, 217

array enumeration, 189

asynchronous dispatch, 210

callback, 203

caret (^) symbol, 188

concurrent queues, 229230

copies of captured variables, 191192

copying, 192193

direct use and deadlock, 208

error handling, 200202

flexibility, 201

function pointers, 191

global, 192193

Grand Central Dispatch (GCD), 216

handler blocks, 197203

heap, 192193

hiding complicated type, 194

inability to cancel, 218

inline, 188189

instance methods, 190

instance variables, 190

memory regions, 191

network fetchers, 199200, 205

as objects, 189190

objects owning, 203207

only executed once, 225

parameters, 194

pointer declaring size of, 191

queues to schedule in, 203

reference counting, 190, 192

registering to observe notification through, 219

retain cycles, 160, 203207

returning int, 188

return type, 194

running on queue, 221

runtime component, 188

scope, 188, 189, 192

self variable, 190

splitting up success and failure cases, 200202

stack, 192193

synchronous dispatch, 210

timers and, 261262

types, 188, 194196, 198199

used as function, 188189

used as variable, 188

variables, 189, 194, 210

Boolean properties

methods, 100

specifying name of getter, 31

BOOL type, 194

breakpoints, 88

_bridge keyword, 244

_bridge_retained keyword, 244

_bridge_transfer keyword, 244

buffer parameter, 99

business logic, decoupling data from, 115

buttons, 42

buttonWithType: method, 42

C

C++

exceptions, 165

function names, 96

NS_OPTIONS enumeration, 22

scope of instance variables, 26

system libraries, 137

caches

automatically removing objects, 251

cost limit, 249250

freeing memory, 250252

NSCache class, 248252

NSDictionary class, 248252

order objects evicted, 249

pruning contents, 248249

retaining keys, 248

thread safe, 248

URL retrieved as cache key, 250

caching

delegate responding to selectors, 122123

images from Internet, 248252

methods delegates implement, 122

optimization of, 121

CALayer class, 62

callback blocks, 203

camel casing names, 95

cancel method, 218

capitalizedString selector, 6364

catch block and exceptions, 166

categories, 115

accessor methods, 131

associated objects, 131

avoiding properties, 130133

breaking class implementation into segments, 123127

inability to synthesize variables, 131

loading, 252

load method, 253

methods, 127128

namespacing name of, 128129

overriding methods, 127129

prefixing names, 74

prefixing third-party names, 127129

CFArray class, 243

CFArrayGetCount function, 243

CFArrayRef class, 243

_CFArray struct, 243

CFDictionaryKeyCallBacks struct, 245

CFDictionary type, 244

CFDictionaryValueCallBacks struct, 245

CFEqual class, 247

CFHash class, 247

CFMutableDictionary type, 244

CFNetwork framework, 234

CFString class, 234

CFURLRequest data structure, 126

CGFloat scalar type, 30

CGPoint data structure, 235

CGRect data structure, 34, 235

CGSize data structure, 235

char type, 1724

Clang compiler, 153

blocks and, 188

class_addMethod runtime method, 60

Class Cluster pattern, hiding implementation detail, 4247

class clusters, 12, 43

adding concrete implementation, 46

checking class of instance of, 46

Cocoa, 4546

collection classes as, 45

Factory pattern, 44

member objects, 45

subclasses inheriting from abstract base class, 46

class-continuation category, 78, 30, 130

classes implementing protocol, 117118

data definitions, 135

hiding implementation detail, 133140

implementation file definition, 133140

instance variables, 27, 122, 133134

methods, 133134

mixing Objective-C and C++ code, 135137

objects conforming to private protocols, 138139

private methods, 103, 138

properties, 135

read-only properties, 137138

classes, 25

attaching custom data with associated objects, 4750

breaking implementation into segments, 123127

categories adding methods to, 127128

checking instance of class cluster, 46

collections, 243

comparing for equality, 37

copying mutable and immutable variants, 112113

custom, 12

defining blocks in instance method, 190

delegate protocols, 117118

delegates, 7

designated initializers, 7884

documentation, 44

dynamically adding method for unknown selector, 5556

equality-checking methods, 36

forward declaring, 6, 8

Foundation framework, xi, 8

header files, 45

hierarchy, 6971

hooking into forwarding paths, 55

implementation files, 45

inheritance, 7, 4243

initializers, 78

initializing, 252257

instance variables, 26, 28, 130

internal methods, 102

introspection, 6671, 92

limiting imports to, 6

literals and, 12

loading, 252257

metadata, 68

methods, 54, 62, 115

multiple alerts, 4849

multiple network fetchers, 199

mutable, 4042, 89

namespace clashes, 100

naming, 95, 100101

not leaking, 140142

not understanding messages, 5462

parent class, 68

prefixing names, 7374

properties, 89

protocols, 120

referring to each other, 6

representing rectangle, 7879

retrieving methods for selectors, 64

shared-instance method, 225

system-supplied, 129

toll-free bridging, 243247

translation unit, 14

type definition, 196

class_getInstanceMethod method, 64, 66

class objects, 27, 6671, 191

class-specific equality methods, 3940

Class type, 68

C-level APIs, 234235

C-level facilities for talking to networks, 234

close method, 163

Cocoa, xi, xiii, 173, 234

class clusters, 4546

protocol language feature, 116

two-letter prefixes, 74

UI work on main thread, 202

zombies, 177183

Cocoa Touch, xi, xiii, 173, 234

UI work on main thread, 202

code

accessing from multiple threads, 208

calculating offset at compile time, 27

conventions for generating, 27

documenting interface to, 115

incompatibility at runtime, 27

memory leaks, 105

mixing Objective-C and C++ and class-continuation category, 135137

readable, 18

reducing separation with handler blocks, 197203

segmenting into functional areas, 126

thread-safe single-time execution, 225226

waiting unnecessarily on lock, 208

collection classes

as class clusters, 45

mutable or immutable properties, 9294

shallow copying, 113

collections, 234

adding objects, 40

classes for, 243

custom memory-management semantics, 243247

enumerating, 236243

guaranteeing types of objects in, 242

looping through, 223224

mutable objects, 8990

retrieving objects from, 6970

toll-free bridging, 243247

comparing objects for equality, 3642

compiler

accessor methods, 25, 2829

deciding which code executes, 12

instance variables, 28

Objective-C++ mode, 167

compiler flag enabling exception-safe code, 105

_completion function, 76

completion handler, 203

block types as, 198199

instance variables, 203

other classes creating, 205

completion-handler block, 205206

completionHandler property, 205, 207

concurrent queues, 210211

blocks, 229230

concurrent threads, 223

reads as normal blocks and writes as barrier blocks, 212

connections handling error representing what happened, 107

connectionWithIdentifier: method, 142

constants

defining, 1213

exposing externally, 1415

global, 17

global symbol table, 15

header file declaration, 15, 17

implementation file definition, 13, 15, 17

naming, 13, 1516

naming values, 1718

prefixing class name, 13, 16

translation unit, 17

types, 1217

const qualifier, 14

constructors, 9697

containers with mutable classes and equality, 4042

copy attribute, 3031

copyDescription callback, 247

copy helper, 191

copying

deep or shallow, 113114

designated initializer, 110, 112

mutable and immutable variants of class, 112113

objects, 109114

copy message, 192

copy method, 109110, 112113, 154

copyWithZone: method, 109110, 112114, 247

CoreAnimation framework, 137, 235

CALayer class, 62

CoreAudio framework, 234235

CoreData databases, 142

CoreData framework, 235

accessing properties of NSManagedObjects class, 5556

anonymous objects, 142

CoreFoundation framework, 234, 243

dictionaries, 244245

zombie objects, 179

CoreFoundation objects

cleaning up, 160

releasing references, 162

CoreGraphics framework, 235

CGRect variable, 34

CoreText framework, 235

countByEnumeratingWithState: method, 239

counters for objects, 145152

count method, 46

_cppClass instance variable, 136

C programming language

accessing stack-allocated struct member, 28

calling functions, 5051

memory model, 2

Objective-C as superset of, 2, 4

prefixing function names, 77

seamless casting data structures with Objective-C objects, 234

static binding, 5051

custom

classes, 12

data attaching to classes with associated objects, 4750

memory-management semantics, 243247

.cxx_destruct method, 160161, 162

D

dangling pointer, 149

data

decoupling from business logic, 115

encapsulating, 130

equality, 40

ownership semantics, 3031

databases, interfaces for persisting objects, 235

data source, 115123

Data Source pattern, 120121

data source protocol, 120

data structures, 2D rendering, 235

_dateOfBirth instance variable, 27

deadlocks

dispatch queues, 228

getters, 227

synchronization blocks, 208

dealloc method, 154, 160165, 181

debugDescription method, 8889

debugger, invoking print-object command within, 8889

debugging

breakpoints, 88

dispatch_get_current_queue function, 231

load method, 253254

memory-management problems, 177183

opaque methods, 6266

printing object to inspect during, 8489

public and private methods, 102

retain counts, 185186

splitting classes into categories, 126127

deep copy, 113114

deep equality, 40

#define preprocessor directive versus typed constants, 1217

#define preprocessor macros, 2022

delegate methods, 49, 119120

Delegate pattern, 115123, 171, 197

delegate protocols, 7, 117118, 197198

errors, 107

methods, 118119

delegates

anonymous, 141

caching methods, 122

classes implementing, 7

implementing, 117

introspection, 119

list views, 120

methods, 119

network fetchers, 119

nonowning relationship, 117

objects, 115123

obtaining information from, 119120

passing errors to, 107

property definition, 140

responding to selectors, 121123

task completion notification, 197198

description message, 84

description method

dictionary within, 8687

implementing, 8489

overriding, 8586

piggybacking on NSDictionary class’s implementation, 8687

returning string from, 8687

descriptor variable, 191

designated initializers, 7884

EOCRectangle class, 81

EOCSquare class, 8081

multiple, 8183

overriding superclass, 80

Rectangle object, 79

superclass, 80

destructor function, 231

device orientations supported by views, 20

dictionaries, 243

block-based enumeration, 241

CoreFoundation framework, 244245

within description method, 8687

enumerating, 237238

fast enumeration, 239240

Foundation framework, 244

immutable variants, 12

keys, 1112, 48, 237238, 241, 245247

key-value pairs, 1011

literals, 1011

memory-management semantics, 140141

mutable arrays and, 11

nil values and exceptions, 11

objects, 11, 241242

retaining keys, 248

size of, 244245

storing downloaded images, 248

subscripting, 11

user-created pruning code, 248

values, 238, 241, 245247

dispatch_after argument, 216

dispatch_apply function, 223224

dispatch_async argument, 216, 220

dispatch_function_t type, 231

dispatch_get_current_queue function, 226231

dispatch_group_async function, 220

dispatch_group_enter function, 220

dispatch_group_leave function, 220

dispatch_group_notify function, 221

dispatch groups

associating tasks with, 220

platform scaling and, 220224

timeout value, 221

tracking tasks submitted to serial queues, 222223

dispatch_group_wait function, 221

dispatch_once function, 217, 225226

dispatch_once_t type, 225

dispatch queues, 91, 187, 217

deadlock, 228

versus locks for synchronization, 208213

dispatch_sync argument, 216

dispose helper, 191

doADaysWork, 45

documentation, 44

doesNotRecognizeSelector: exception, 55, 57

“Don’t Repeat Yourself” (DRY) principle of software development, 219

doSomething: method, 108

doSomethingThatMayThrow object, 166

doSomethingThatUsesItsInternalData method, 256

doSomethingWithInit: method, 174

doSomethingWithObject: method, 186

dot syntax, 25, 2728

DRY. See “Don’t Repeat Yourself” (DRY) principle of software development

duplicate-symbol error, 7477

dynamic binding, 2, 4, 5152

on top of dynamic binding, 213214

@dynamic keyword, 29

dynamic libraries, 233

dynamic method resolution, 5556, 5962

@dynamic properties, 5556, 5962

dyspatch_sync function, 227228

E

else statement, 192

Employee example, 45, 46

encapsulating data, 130

endContentAccess method, 251252

enumerateKeysAndObjectsUsingBlock: method, 242

enumerateKeysAndObjectsWithOptions: method, 242

enumerateObjectsUsingBlock: method, 189

enumerateObjectsWithOptions: method, 242

enumerating collections

arrays, 236237

block-based enumeration, 240243

dictionaries, 237

fast enumeration, 239240

for loops, 236237

NSEnumerator object, 237239

Objective-C 1.0 enumerations, 237239

reversing, 238239

sets, 237

enumerations

adding typedef, 18

backward compatibility, 2022

behavior of, 242

combining options, 1920

forward declaring types, 18

grouping error status codes, 22

member values, 1819

naming constant values, 1718

next object in, 238

options, 1724

readable code, 18

socket connections, 1718

states, 1724

status codes, 1724

switch statement, 23

types, 18

value backing, 18

enumeration type, 1724

error codes, 108109

enumerators, reverse, 238239

enum type, 1724

EOCAnimatedView class, 16

EOCAnimatedView.m file, 14, 16

EOCAutoDictionary class, 5960, 62

EOCBaseClass class, 255

EOCClassA class, 169, 171, 253, 256

EOCClassB class, 169171, 253, 256

EOCClass class, 190, 260, 263

shared-instance method, 225

EOCClass.h header file, 136137

EOCClass instance, 205

EOCClass.mm implementation file, 136

EOCClass object, 180, 182

EOCConnectionStateConnected enumeration, 19

EOCConnectionStateDisconnected enumeration, 19

EOCConnectionState enumeration, 18, 20

EOCDatabaseConnection protocol, 141142

EOCDataModel object, 116

EOCDelegate object, 140

EOCDog class, 37

EOCDrawable protocol, 7

EOCEmployer class, 56

EOCEmployer.h header file, 56

EOCImageTableView class, 101

EOCLibrary library, 77

eoc_myLowercaseString method, 65

EOCNetworkFetcher class, 117, 119, 122

EOCNetworkFetcher object, 116, 207

EOCObject class and private methods, 102103

EOCPermittedDirection enumeration, 22

EOCPerson class, 5, 3132, 35, 3940, 88, 9394, 110111, 114, 124125, 130, 138139, 175

categories, 125126

class-continuation category, 133

implementation file, 6

EOCPerson.h header file, 46, 126

EOCPerson objects, 37, 39, 86

EOCPointOfInterest class, 90, 9192

EOCRectangle class, 7879, 80, 9697

designated initializers, 81, 8284

EOCReleaseCallback function, 247

EOCRetainCallback function, 247

EOCSecretDelegate protocol, 138139

EOCSmithPerson class, 37

EOCSomeBlock type, 195

EOCSoundPlayer class, 7476

EOCSoundPlayerCompletion completion handler, 77

EOCSquare class, 8081

EOCSSmithPerson subclass, 35

EOCStringConstant constant, 15

EOCSubClass class, 255

EOCSuperSecretClass class, 134135

EOCTheClass class, 73

EOCViewClassAnimationDuration constant, 13

equal callback, 247

equality

comparing objects for, 3642

data, 40

deep versus shallow, 40

mutable classes in containers, 4042

objects, 42, 70

strings, 99

equality-checking methods, 3637

equality methods, 3940

equality (==) operator, 36, 70

error codes as enumeration type, 108109

error domains

defining what error occurred, 106107

libraries, 109

error parameter, 108

errors, 106107

error status codes

grouping, 22

named constants as, 1724

evictsObjectsWithDiscardedContent property, 251

exceptions, 104

Automatic Reference Counting (ARC), 105

C++, 165

catch block, 166

causing application to exit, 105

code catching and handling, 165

fatal errors only, 105106

Key-Value Observing (KVO), 165

memory leaks, 105

nil objects in arrays, 910

nil values in dictionaries, 11

object destruction, 166167

Objective-C, 165

throwing in overridden methods, 105106

try block, 166

zombie objects, 178

exception-safe code, 105

memory management, 165168

extern keyword, 15

F

factory method, 98

Factory pattern, 44

fast enumeration, 236, 239240

_fetchedData instance variable, 205

fetcher class, 116117

file descriptors, 162

@finally block, 166, 167

_firstName instance variable, 2627, 28

-fobjc-arc-exceptions flag, 105, 167168

_foo instance variable, 150

foo setter accessor, 150

for loops, 174, 176

versus block enumeration, 236243

enumerating collections, 236237

forward declaring, 8

classes, 6

imports, 7

types for enumerations, 18

_forwarding_ function, 181182

forwarding paths, 5455

forwardingTargetForSelector: method, 56

forwardInvocation:method, 57

Foundation framework, 89, 233

classes, xi, 8, 12, 243

collections, 234, 243

dictionaries, 244

helpers defined in, 2022

importing entirety, 5

introspection, 6671

loading, 253

NSCache class, 248

NS class prefix, 234

NSTimer class, 258

string processing, 234

zombie objects, 179

Foundation.h header file, 5

frameworks

See also system frameworks

base header file, 5

protocol language feature, 116

third-party, 233

friendship category, 130

_friends instance variable, 111112

friends property, 94

full forward mechanism, 57

fullName method, 3334

function pointers, 191

functions, 2

blocks used as, 188189

calling, 12

calling versus messaging, 1

polymorphism, 2

tail-call optimization, 5354

2D rendering, 235

unknown until runtime, 51

G

Galloway Web site, xii

garbage collector, 145, 169

GCD. See Grand Central Dispatch (GCD)

getCharacters:range: method, 99

getter=<name> attribute, 31

getters

_block syntax, 210

deadlock, 227

instance variables, 25, 3536

properties, 30

running concurrently, 210

selectors, 56, 60

serial synchronization queue, 210

specifying name of, 31

global blocks, 192193

global constants, 17

global symbol table, 15

global variables

defining source of error, 106

name conflicts, 74

Grand Central Dispatch (GCD), xi, xiii, 187

barrier feature, 211

blocks, 216, 217

dispatch groups, 220224

dispatch queues, 217

inability to cancel blocks, 218

locks, 208213

versus performSelector: method and friends, 213217

queue currently being executed, 226231

queue priorities, 218

queue-specific data functions, 230231

singleton instances, 225226

synchronization, 217

threads, 173, 223

when to use, 217220

graphics, rendering, 235

grouping tasks, 220224

groups, incrementing or decrementing number of tasks, 220

H

handler blocks, reducing code separation with, 197203

hash callback, 247

hashes, 3840, 42

hash methods, 3739, 42, 247

hash tables, hash as index in, 38

hasPrefix: method, 99

header files, 48

constants, 15, 17

extern keyword, 15

protocols, 7

superclass, 7

heap

allocating and de-allocating memory, 24

copying blocks from stack, 192

managing memory, 3

heap-allocated memory, cleaning up, 160

heap blocks, 192193

height instance variable, 96

_height instance variable, 80, 84

helpers, backward compatibility, 2022

.h file extension, 4

high memory, reducing waterline, 173177

HTTP, obtaining data from server, 126

HTTP requests to Twitter API, 74

HTTP-specific methods, 126

I

IDE. See Integrated Development Environment (IDE)

identifier property, 92

id<EOCDelegate> type, 140

id<NSCopying> type, 141

id type, 6669. 215, 242

if statement, 45, 153, 192

images, caching from Internet, 248252

immutable arrays, 45

immutable collection-class properties, 9294

immutableCopy method, 112113

immutable objects, 32, 8994

immutable variants, 12

implementation

class-continuation category hiding detail, 133140

exchanging, 6364

hiding with class clusters, 4247

instance variables, 27

implementation files, 45

class-continuation category, 133140

constants, 13, 15, 17

#import preprocessor directive, 7

imports, forward declared, 7

IMPs function pointers, 6263

#include preprocessor directive, 7

indexes for arrays, 12

inheritance, hierarchies with equality, 37

initialize method

called lazily, 254

inheritance, 255

lean implementation of, 255256

runtime in normal state, 254

superclass running, 254255

thread-safe environment, 254

initializers

classes, 78

designated, 7884

instance variables, 35

methods, 35

naming, 78

throwing exceptions, 81

init method, 7981

initWithCoder: method, 82, 84

initWithDimension: method, 81

initWithFormat: method, 151

initWithInt: method, 149

initWithSize: method, 97

initWithTimeIntervalSinceReferenceDate: designated initializer, 78

initWithWidth:andHeight method, 81

in keyword, 239

inline blocks, 189

instances

base class, 45

instance variables, 68

metadata, 68

value passed in, 106

instance variables, 25

accessor methods, 34

Automatic Reference Counting (ARC) handling, 160161

bitfield, 122

blocks, 190

class-continuation category, 27, 122, 133134

classes, 28, 130

cleanup code during deallocation, 160

completion handler, 203

declaring, 2526

directly accessing internal, 3336

documenting not exposed publicly, 133140

externally accessing, 33

getters, 25

inability to be synthesized by category, 131

instances, 68

memory-management semantics, 158160

naming, 2829

network fetchers stored as, 199

offsets, 27, 92

only known internally, 134

pointer to instance, 136

private, 90

properties, 3336

qualifiers, 159160

queue usage, 227

runtime, 27

safe setting of, 159

scope, 26

setters, 25, 35

setting to 0 (zero), 79

as special variables held by class objects, 27

subclasses, 46

superclass, 35

synthesis, 29

integers

defined at compile time, 257

parsing strings as, 98

Integrated Development Environment (IDE), 195

interface

classes implementing protocol, 117

documenting code, 115

Internet, caching images from, 248252

introspection, 45, 6671, 113

classes, 92

delegates, 119

methods, 46, 6971

objects, 94

retrieving objects from collections, 6970

int type, 98, 194

intValue method, 98

invoke variable, 191

iOS, xi, xiii

blocked UI thread, 187

blocks, 188

Cocoa Touch, 173, 234

main thread, 221

mapping functionality, 235

method called on application termination, 163

operation queues, 217

social networking facilities, 235236

UI framework, 78

UI work performed on main thread, 226

iOS applications

main function, 173174

UIApplication object, 147

iOS 5.0 SDK, 74

isa instance variable, 181

isa pointer, 6869, 191

isCancelled property, 218

isContentDiscarded method, 250

isEqual: method, 3639, 40, 42, 70, 247

isEqualToArray: method, 39

isEqualToDictionary: method, 39

isEqualToString: method, 36, 39, 99

isFinished property, 218

isKindOfClass: method, 6970

island of isolation, 152

isMemberOfClass: method, 69

J

Java

exceptions, 104

function names, 96

instance variables scope, 26

interfaces, 115

K

kAnimationDuration constant, 14

kAnimationDuration global variable, 13

keys

associated objects, 48

dictionaries, 1112, 48

retain and release callbacks, 247

static global variables, 48

Key-Value Coding (KVC), 92

Key-Value Observing (KVO)

exceptions, 165

notifications, 34, 137

operation properties, 218

properties, 165

KVC. See Key-Value Coding (KVC)

L

_lastName instance variable, 28

lastObject method, 46

lazy initialization, 3536

length method, 98

lengthOfBytesUsingEncoding method, 9899

libdispatch, xi

libraries

duplicates, 74

error domain, 109

Private category, 127

retain count, 185

list views, 120

literal arrays, 910

literal dictionaries, 1011

literal numbers, 89

literals, 12

LLDB debugger, 8889

load method, 252256

localizedString method, 100

localizedStringWithFormat: method, 98

local variables, 14

breaking retain cycles, 160

memory-management semantics, 158160

qualifiers, 159160

locks

Grand Central Dispatch (GCD), 208213

recursive, 208

threads taking same lock multiple times, 208

lowercaseString method, 98

lowercase strings, 98

lowercaseString selector, 55, 63, 6466

M

Mac OS X, xi, xiii

blocked UI thread, 187

blocks, 188

Cocoa, 173, 234

garbage collector, 145, 169

main thread, 221, 226

method called on application termination, 163

NSApplication object, 147

operation queues, 217

social networking facilities, 235236

main function, 173174

main interface, defining properties, 132

main thread, 173

blocked terminating application, 197

UI work in Cocoa and Cocoa Touch, 202

malloc() function, 160

MapKit framework, 235

MKLocalSearch class, 202

memory

allocated on stack for blocks, 192

caches freeing, 250252

heap-space allocation for objects, 23

releasing large blocks of, 162

reusing, 177

segmenting into zones, 109

memory leaks, 168, 214

code safe against, 105

multiple objects referencing each other cyclically, 152

object not released, 153

retain cycles, 169

memory management

Automatic Reference Counting (ARC), 155156

debugging problems with zombies, 177183

exception-safe code, 165168

property accessors, 150

reference counting, 145152, 183

memory-management methods, 2

illegally calling, 154

overriding, 161

memory-management model, 168

memory-management semantics, 35

attributes, 91, 131

bypassing, 34

custom, 243247

objects, 47

properties, 3031

variables, 158160

memory regions, 191

message dispatch and Automatic Reference Counting (ARC), 161

message forwarding, 52

dynamic method resolution, 5556, 5962

flow diagram, 5759

full forward mechanism, 57

receiver, 57, 59

replacement receiver, 5557, 59

selector, 57

messageName selector, 52

message object, 153

messages

arguments, 50

description message, 84

floating-point values, 53

forwarding path, 5455

method lookup, 103

names, 50

object not understanding, 5462

objects responding to all, 103

passing, 5054

receivers, 52, 55

selectors, 50, 52

structs, 53

superclass, 53

unhandled, 57

values, 50

messaging, 4, 25

versus function calling, 1

runtime and, 12

structure, 1

metaclass, 68

metadata, 68

method dispatch, 34

method dispatch system, 103

method_exchangeImplementations method, 64

method-naming rules and Automatic Reference Counting (ARC), 154158

methods

arrays, 45

Automatic Reference Counting (ARC), 154158

autoreleasing objects, 156157

backtrace, 126127

badly-named, 97

Boolean indicating success or failure, 107108

Boolean properties, 100

categories, 123127

causing action to happen on object, 100

as C function, 53

class-continuation category, 133134

classes, 54, 115

class methods, 64

debugging opaque methods, 6266

delayed execution of, 213

delegate methods, 119

delegate protocols, 118119

delegates, 122

documenting not exposed publicly, 133140

dynamically adding for unknown selector, 5556

dynamic binding, 52

equality-checking, 3637

exchanging implementations, 6366

get prefix, 100

HTTP-specific, 126

introspection, 46

introspection methods, 6971

memory-management, 2

mutable arrays, 45

naming, 1, 95

newly created value, 100

nil / 0, 106

not reentrant, 227

NSObject protocol, 85

objects, 5054, 150151

out-parameter passed to, 107108

owned by caller, 154

parameters, 99, 100

prefixing names, 74, 102104

return type, 98

runtime, 6266

system-supplied class, 129

threads, 164165, 213

throwing exceptions, 105106

types, 100

verbose naming, 96100

well-named, 97

method swizzling, 6266

.m file extension, 4

MKLocalSearch class, 202

multithreaded applications, 187

multithreading, 187

mutable arrays, 45

dictionaries and, 11

methods, 45

runtime, 257

subscripting, 11

mutable classes, 89

equality in containers, 4042

mutable collection-class properties, 9294

mutableCopy method, 112113, 154

mutableCopyWithZone: method, 112

mutable dictionaries, 140141

mutable objects, 8990

mutable variants, 12

_myFirstName instance variable, 28

_myLastName instance variable, 28

N

name clashes, 74

name conflicts, 74

named constants as error status codes, 1724

namespace clashes, 7377, 100

naming

camel casing, 95

classes, 95, 100101

clear and consistent, 95101

delegate protocol, 117

methods, 95, 96100

methods rules in Automatic Reference Counting (ARC), 154158

prefixing, 7377

prepositions in, 95

private methods, 102104

properties, 98

protocols, 100101

superclass, 101

variables, 95

nesting autorelease pools, 174175

networkFetcher:didFailWithError: method, 118

networkFetcher:didUpdateProgressTo: method, 121

network fetchers, 198199

adding itself to global collection, 206

blocks, 199200

completion handlers, 200, 203

deallocating, 207

delegates, 119

errors, 200202

keeping alive, 206207

multiple, 199

retaining block, 205

stored as instance variables, 199

networks, C-level facilities for talking to, 234

new method, 154

newSelector selector, 64

nextObject method, 237238

NeXTSTEP operating system, 234

NIBs XML format, 82

nil objects, 910

nonatomic attribute, 29, 3233

nonfatal errors indicators, 106

nonfragile Application Binary Interface (ABI), 27

non-Objective-C objects

cleaning up, 160

releasing references, 162

notifications, 15

notify function, 221

NSApplicationDelegate object, 163

NSApplication object, 147

NSArray class, 8, 12, 3940, 4546, 86, 89, 100, 112, 129, 234, 243

NSArray collection, 236

NSAutoReleasePool object, 176

NSBlockOperation class, 218219

NSCache class versus NSDictionary class, 248252

NSCalendar class, 132

_NSCFNumber type, 55

NSCoding protocol, 8183

NSCopying object, 141

NSCopying protocol, 109114, 247

NSDate class, 78

NSDictionary class, 8, 12, 39, 140, 234, 241

versus NSCache class, 248252

piggybacking on description method of, 8687

retaining keys, 248

NSDictionary collection, 236

NSDictionary object, 48, 231, 246

NSDiscardableContent protocols, 250

NSEnumerationConcurrent option, 242

NSEnumerationOptions type, 242

NSEnumerationReverse option, 242

NSEnumerator class, 236

NSEnumerator object, 237240

NS_ENUM macro, 2124

NSError class, 106107

NSError object, 106109

NSFastEnumeration protocol, 239240

NSFetchedResultsController class, 142

NSFetchedResultsSectionInfo protocol, 142

NSHTTPURLRequest category, 126

NSInteger scalar type, 30

NSInvocation object, 57, 59

NSLinguisticTagger class, 234

NSLog class, 149, 253

NSManagedObject class, 29

NSManagedObjects class, 5556

NSMutableArray class, 45, 100, 112

NSMutable arrays, 41

NSMutableCopying protocol, 112

NSMutableDictionary class, 247

NSMutableSet class, 41, 94

NSMutableString subclass, 30

NSMutableURLRequest category, 126

NSMutableURLRequest class, 126

NSNotificationCenter API, 15, 203

NSNotificationCenter class, 162, 219

NSNumber class, 89, 12, 129

NSNumber object, 174, 185

NSObject class, xi, 37, 5455, 67, 79, 85, 109, 213, 233, 234, 247

NSObject object, 181

NSObject protocol, 3637, 67, 85, 88, 146, 183

NSOperation class, 218, 219

NSOperationQueue class, 203, 217218

NS_OPTIONS macro, 22, 24

NSProxy class, 67, 70, 85

NSPurgeableData class, 250

NSPurgeableData objects, 251

NSRecursiveLock class, 208

NSSet class, 94, 113, 241

NSSet collection, 236

NSString class, 8, 12, 36, 3839, 128129, 153, 253

methods, 9799

selector table, 6364

NSString global constant, 108

NSString instance, 23, 67

NSString object, 8, 15, 151, 174, 185

NSString type, 30

NSString* type, 2, 3

NSTimeInterval type, 13

NSTimer class, 258263

NSUInteger type, 22

NSURLConnection class, 107, 234

NSURLConnectionDelegate method, 107

NSURLErrorDomain domain, 106

NSURLRequest class, 126

_NSZombie_ class, 181

NSZombieEnabled environment variable, 178, 181

_NSZombie_EOCClass object, 180

_NSZombie_OriginalClass object, 181

_NSZombie_ template class, 180

NSZone class, 109

null pointer, 108

number object, 149

numbers and literals, 89

O

OBJC_ASSOCIATION_ASSIGN type, 47

OBJC_ASSOCIATION_COPY_NONATOMIC type, 47

OBJC_ASSOCIATION_COPY type, 47

objc_AssociationPolicy enumeration, 47

OBJC_ASSOCIATION_RETAIN_NONATOMIC type, 47

OBJC_ASSOCIATION_RETAIN type, 47

objc_autoreleaseReturnValue function, 157158

objc_duplicateClass() function, 181

objc_getAssociatedObject method, 47

objc_msgSend function, 52, 54

objc_msgSend role, 5054

objc_removeAssociatedObjects method, 48

objc_retainAutoreleaseReturnValue function, 157

objc_retain method, 154

objc_setAssociatedObject method, 47

ObjectA object, 146

objectAtIndex: method, 9, 46

ObjectB object, 146

ObjectC object, 146

object_getClass() runtime function, 179

object graph, 146, 149150, 168

_object instance variable, 158

Objective-C

error model, 104109

exceptions, 165

garbage collector, 145

messages and zombie objects, 179180

messaging structure, 1

roots, 14

runtime component, 2

square brackets, 1

as superset of C, 2, 4

verbose syntax, 1, 8

Objective-C 1.0 enumerations, 237239

Objective-C++ mode, 167

Objective-C objects

Automatic Reference Counting (ARC), 235

seamless casting with C data structures, 234

what to do with, 244

objects, 25

accessing data encapsulated by, 27

anonymous, 140142

associated with objects, 47

autoreleasing, 108, 155157

becoming related to each other, 146

binning into arrays with hash, 38

blocks as, 189190

calling methods, 5054

classes, 68, 69, 120

cleaning up observation state, 162165

collections, 6970, 242

comparing for equality, 3642

conforming to private protocols, 138139

copying, 109114

counters, 145152, 183

deallocating, 146, 149, 162, 169

declaring, 2

delegates, 115123

description message, 84

designated initializer, 7884

destruction and exceptions, 166167

dictionaries, 11

equality, 70

equality-checking methods, 3637

exceptions, 105

heap-space allocated memory, 23

id type, 6667

immutable, 32, 8994

inconsistent internal data, 81

instance variables, 25

introspection, 94

invalid references to, 146

memory, 2

memory-management semantics, 47

memory regions, 191

messaging, 25

methods, 100, 142, 150151

methods as C functions, 53

multiple referencing each other cyclically, 152

mutable, 3031

nonvalid, 149

notifications, 15, 162

not understanding message, 5462

object graph, 150

operation queues as, 217

overhead, 4

owning other objects, 146, 148

pointers, 2, 67

printing to inspect while debugging, 8489

properties, 2533

proxy, 7071

reference counting, 173

releasing, 156, 173177

releasing references, 162165

responding to messages, 103

retain count, 146, 173, 183

retaining, 156

runtime, 6768

with same hash, 42

serializing with NIBs XML format, 82

sets, 237

stack-allocated memory for, 2, 3

storage policies, 47

synchronized against self variable, 208

talking to each other, 115123

tasks, 221222

types, 4, 6671, 242

variable of Class type, 68

variables, 2

when application terminates, 163

zombie objects, 179

object1 variable, 10

object2 variable, 10

object3 variable, 10

obj_msgSend_fpret function, 53

obj_msgSend_stret function, 53

obj_msgSendSuper function, 53

observation state, 162165

opaque methods, debugging, 6266

opaqueObject property, 60

open: method, 163

operation queues, 217220

operations, 218219

@optional keyword, 118

options

combining, 1724, 1920

enumerations, 1724

OR operator, 19, 22, 23

out-parameter, 99, 107108

overriding methods, 129

P

parameters

methods, 99100

pointers to structures, 245

parsing strings, 234

passing messages, 5054

performSelector: method versus Grand Central Dispatch (GCD), 213217

performSelector:withObject:withObject: method, 215

personWithName: method, 156

placeholder arrays, 45

platform scaling and dispatch groups, 220224

po command, 88

pointers

comparing for equality, 37

dangling pointer, 149

denoting objects, 2

nilling out, 149

to struct, 243

pointerVariable variable, 67

polymorphism, 2

prefixing

category third-party names, 127129

names, 7377

preprocessor directive, 13

printGoodbye() function, 51

printHello() function, 51

print-object command invoking in debugger, 8889

Private category, 127

private instance variables, 90

private methods, 102104, 138

programmer error, 164

properties, 2533

atomic, 208209

attributes, 2933, 131

avoiding in categories, 130133

class-continuation category, 135

classes, 89

collection-class mutable or immutable, 9294

comparing for equality, 37

custom initializer, 3132

in definition of object, 27

dot syntax, 2728

encapsulating data, 130

getter methods, 30

instance variables, 3336, 35, 92

Key-Value Coding (KVC), 92

Key-Value Observation (KVO), 165

lazy initialization, 3536

main interface definition, 132

memory-management semantics, 3031, 34, 91, 131

naming, 98

nonowning relationship, 30

operations, 218

owning relationship, 30

read-only, 30, 32, 89, 9091

read-write, 30, 89

setter methods, 30

single words as, 98

synchronization, 208210

value potentially unsafe, 171

weak, 117

property accessors, 150, 165

@property attribute, 47

property dot syntax, 34

@property syntax, 27

protocol language feature, 116

protocols, 115

acquiring data for class, 120

anonymous objects, 140142

declaring conformance, 8

Delegate pattern, 115123

header files, 7

hiding implementation detail in API, 141

methods for database connections, 141142

namespace clashes, 100

naming, 100101

objects conforming to private, 138139

proxy, 7071

public API, 9294

public interface declaring instance variables, 2526

pure C functions name conflicts, 74

Q

QuartzCore framework, 235

querying structures, 122

_queueA variable, 228

queue barrier, 211

_queueB variable, 228

queues

associating data as key-value pair, 230231

currently being executed, 226231

hierarchy, 229230

instance variables, 227

many reads and single write, 211212

priorities, 218

reading and writing to same, 209210

scheduling callback blocks, 230

synchronization of property, 229

R

readonly attribute, 30, 9091

read-only properties, 30, 32, 89, 9091

class-continuation category and setting internally, 137138

readonly property, 9192

readwrite attribute, 30

read-write property, 89

receiver, 55, 57, 59

rectangle class, 7

Rectangle object, 79

rectangles, 7879

recursive locks, 208

reference-counted objects, 192

reference counting, xiii, 23, 3, 145152, 173, 220221

automatic, 153161

Automatic Reference Counting (ARC) and, 153161

autorelease pools, 150151, 173177

blocks, 190, 192

catching exceptions, 168

destruction of objects, 166167

indicating problem areas, 153161

manually releasing objects, 162

memory management, 183

operation of, 146150

refactoring, 168

retain cycles, 152

zombie objects, 179

reference-counting architecture, 168

references, releasing, 162165

release method, 146, 154, 159, 184

removeFriend: method, 94

replace function, 95

replacement receiver, 5557, 59

_resetViewController method, 104

resolveClassMethod: method, 55

resolveInstanceMethod: method, 56

respondsToSelector: method, 119

results controller, 142

retain count, 146, 173, 183, 185186

autorelease pool, 146

balancing, 151

changing, 184

current, 183

at given time, 184

incrementing and decrementing, 146, 150

inspecting, 146

at least 1, 149

very large value, 184185

retainCount method, 146

Automatic Reference Counting (ARC), 183184

avoiding use of, 183187

retain cycles, 50, 152, 205207

avoiding, 168172

blocks, 203207

detecting, 169

memory leaks, 169

objects referencing each other, 168169

retain method, 146, 154, 156157, 159, 184

ret object, 214215

reverse enumerator, 238239

root classes, 85

run loops and timers, 258

runtime, 25

dealloc method, 162

deciding which code executes, 1

as dynamic library, 2

functions, 2, 51

instance variables, 27

lookup, 2

memory-management methods, 2

methods, 54, 6266

object types, 4, 6671

reference counting, 3

selectors, 213

structures, 2

updating, 2

zombie objects, 179

S

scalar types, 30

scheduledTimerWithTimeInterval: method, 258

sectionInfo object, 142

sections property, 142

selectors, 57

calling directly, 213

delegates, 121123

getters, 56, 60

IMPs function pointers, 6263

messages, 50

methods, 5556, 6266, 64

parameters, 215

running after delay, 215216

runtime, 213

setters, 56, 60

storing to perform after event, 214

threads, 215216

self variable, 190, 262

completion-handler block referencing, 205

objects synchronized against, 208

serial synchronization queue, 209213

setFirstName: method, 138

setFullName: method, 3334

setIdentifier: method, 92

setLastName: method, 138

set prefix, 56

sets, 243

block-based enumeration, 241

enumerating, 237238

fast enumeration, 239240

objects, 237

setter accessor, 150

setter=<name> attribute, 31

setters

Automatic Reference Counting (ARC), 159

barrier block, 211

instance variables, 25, 35

naming, 31

properties, 30

scalar types, 30

selectors, 56, 60

serial synchronization queue, 210

subclasses overriding, 35

synchronous dispatch to asynchronous dispatch, 210

setup method, 158

setValue:forKey: method, 92

shallow copy, 113114

shallow equality, 40

shape class, 7

sharedInstance method, 225226

Singleton design pattern, 225

singleton objects, 185

Smalltalk, 1

Social framework, 235236

social networking facilities, 235236

sockets, 162

connections and enumerations, 1718

someBlock variable, 188

SomeClass class, 68

SomeCPPClass.h header file, 136

someObject receiver, 52

someString variable, 2

sound file, playing, 7476

stack

autorelease pools, 175

blocks, 192193

copying blocks to heap, 192

memory allocated for blocks, 192

memory allocated for objects, 2, 3

variables, 34

standard view, 48

start method, 195

states and enumerations, 1724

static analyzer, 153

static global variables, 48

static library, 233

static qualifier, 14

status codes and enumerations, 1724

stopPolling method, 260261

stop variable, 241

storage policies, 47

string literal, 8

string method, 98

strings

characters within range of, 99

converting to lowercase, 98

custom classes, 12

equality, 99

factory method, 98

immutable variants, 12

length of, 9899

parsing, 98, 234

prefixed by another string, 99

processing, 234

returning hash of, 39

stringValue method, 151

stringWithString: method, 98

str object, 151, 179

strong attribute, 30

__strong qualifier, 159

structs, 53

structures, 2

delegates, 122

fields sized, 121122

instance variables, 122

parameters pointers to, 245

pointers, 191

querying, 122

styles and enumeration types, 2223

subclasses, 46

overriding setter, 35

throwing exceptions, 105106

Subnet Calc app, xii

subscripting, 9, 1112

superclass

designated initializers, 80

header files defining, 7

inheritance, 7

instance variables, 35

prefixing names, 101

sending messages to, 53

subclasses overriding methods of, 46

super_class pointer, 68, 69

super_class variable, 68

supportedInterfaceOrientations method, 20

switch statements, 2324

sychronization locks versus dispatch queues, 208213

synchronization

Grand Central Dispatch (GCD), 217

properties, 208209

synchronization blocks, 208

@synchronized approach, 226

synchronizedMethod method, 208

synchronous dispatch, 210

@synthesize syntax, 28

system frameworks

AVFoundation framework, 235

CFNetwork framework, 234

class clusters, 45

CoreAudio framework, 234235

CoreData framework, 235

CoreFoundation framework, 234

CoreText framework, 235

dynamic libraries, 233

Foundation framework, 233, 234

UI frameworks, 235

system libraries

catching and handling exceptions, 165

C++ in, 137

system resources

deterministic life cycles, 163

exceptions thrown, 105

file descriptors, 162

memory, 162

performing tasks on, 223

sockets, 162

system-supplied class, 129

T

table view, 101

tagged pointers, 185

tail-call optimization, 5354

tasks

arrays, 221222

asynchronously performing, 197

decrementing number of, 220

delegates, 197198

dispatch groups, 220

grouping, 220224

priorities, 222

system resources, 223

waiting until finished, 221222

temporary objects, 174175

text, typesetting and rendering, 235

third-party classes, 127129

third-party frameworks, 233

third-party libraries

catching and handling exceptions, 165

duplicate-symbol error, 77

threads

implicit autorelease pool, 173

methods, 164165

multiple accessing code, 208

priorities, 219

safety of, 225226

unblocking when long-running tasks occur, 197

thread-safe single-time code execution, 225226

timers

blocks and, 261262

deallocating, 260, 263

invalidating, 258259

repeating, 258, 259

retain cycle, 262

retain-cycle with repeating, 259260

retaining target, 258263

run loops and, 258

scheduling, 258

weak references, 262

title: attribute, 42

toll-free bridging, 55, 234, 243247

translation unit, 14, 17

@try block, 166167

try block exceptions, 166

Twitter API, HTTP requests to, 74

Twitter framework

TW prefix, 74

TWRequest class, 202

TWRequest object, 207

2D rendering data structures and functions, 235

TW prefix, 74

TWRequest class, 74, 202

TWRequest object, 207

typed constants versus #define preprocessor directive, 1217

typedef keyword, 194196

enumerations, 18

types

alias for another type, 194196

blocks, 188, 194196

compiler-dependent, 18

constants, 13, 14

enumerations, 18

literal numbers, 9

methods, 100

objects, 6671

runtime, 4

variable name inside, 194

U

UIAlertView class, 4850

UIApplicationDelegate object, 163

UIApplicationDidEnterBackgroundNotification constant, 16

UIApplicationMain function, 174

UIApplication object, 147

UIApplicationWillEnterForegroundNotification constant, 16

UIButton class, 42

UI frameworks, 235

UIInterfaceOrientationMask enumerated type, 20

UIKit framework, 13, 16, 1920, 42, 78, 82, 235

UIKit.h header file, 5

UIKit iOS UI library, 100

UISwitch class, 31

UITableViewCell object, 78

UITableView class, 101

UITableViewController class, 101

UITableViewDelegate protocol, 101

UI thread, 187

UIVewController class, 103104

UIViewAutoresizing enumeration, 20

UIViewAutoresizingFlexibleHeight option, 19

UIViewAutoresizingFlexibleWidth option, 19

UIView class, 100101, 235

UIViewController class, 5, 100

UIView subclass, 13

unsafe_unretained attribute, 30, 117, 169171

__unsafe_unretained qualifier, 159

uppercaseString selector, 63, 6465

urlEncodedString method, 128129

URLs

downloading data from, 234

errors from parsing or obtaining data from, 106

obtaining data from, 126

retrieved as cache key, 250

user-developed equality methods, 39

userInfo parameter, 262

user interface

unresponsive while task occurs, 197

views, 100

V

value property, 215

values

retain and release callbacks, 247

tagged pointers, 185

variables

_block qualifier, 189

blocks, 188, 189, 210

Class type, 68

const qualifier, 14

copies of captured, 191192

declaring, 2

forward declaring types for enumerations, 18

holding memory address, 67

isa pointer, 68

local, 14

memory-management semantics, 158161

naming, 95, 194

Objective-C objects, 34

pointing to same object, 23

retaining value, 158159

stack, 34

static qualifier, 14

strong references to objects, 158

without asterisk (*), 34

video playback and recording, 235

views, 20, 100101

virtual tables, 2

void return type, 215

void* variable, 191

W

weak attribute, 30, 117

weak properties, 117, 168172

__weak qualifier, 159160

weak references and timers, 262

WebKit web browser framework, 137

web services, 90

while loop, 184

width instance variable, 96

_width instance variable, 80, 84

X

Xcode and zombie objects, 178

Z

zombie classes, 180

zombie objects

debugging memory-management problems, 177183

detecting, 182

determining original class from, 181

exceptions, 178

Objective-C messages, 179180

turning objects into, 179

zones, segmenting memory into, 109