新版本的变更 / Objective-C 2011: ARC

// *** before: ***
@interface Cell : NSObject
@property (nonatomic, retain) NSString *title;  // holds it
@property (nonatomic, assignid delegate;      // does not hold it
@end

// assign was dangerous: after the delegate was deallocated the field kept
// pointing at freed memory, and the next message crashed the program
Controller *controller = [[Controller allocinit];
cell.delegate = controller;
[controller release];
[cell.delegate reload];        // EXC_BAD_ACCESS on a dangling pointer

// *** in version 2011: ***
@interface Cell : NSObject
@property (nonatomic, strongNSString *title;   // holds it, retain renamed
@property (nonatomic, weakid delegate;         // does not hold, and is
                                                 // set to nil automatically
@property (nonatomic, unsafe_unretained) id owner;  // old assign, kept for
                                                 // classes that forbid weak
@property (nonatomic, copy) NSString *name;      // copy is unchanged
@end

Controller *controller = [[Controller allocinit];
cell.delegate = controller;
controller = nil;              // the last strong reference is gone
[cell.delegate reload];        // delegate is already nil - a message to nil
                               // does nothing instead of crashing

// strong is the default for an object property, so it may be omitted;
// weak is the answer to a retain cycle: parent -> strong -> child,
// child -> weak -> parent