Objective-C: NSArray of weak references
2010-03-08 12:04Need an array of weak references? e.g. for delegates. Here’s some good tips.
One convenient way is to box it in a NSValue with a non-retained object.
NSValue *value = [NSValue valueWithNonretainedObjectValue:myObj]; [array addObject:value]; and when you get the object: value = [array objectAtIndex:x]; myObj = [value nonretainedObjectValue];

