2010-03-08 12:04
Need 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];
Tags: dev, objective-c. No Comments »
2009-02-21 17:53
Don’t ignore warnings. If you get a warning it’s probably actually an error – things like misspelt methods (i.e. messages) which would be classed as an error in C++/Java/C# are just warnings due to the dynamic nature of Objective-C – and yet are just as bad (your method isn’t being called!)
So fix all your warnings – if the warning actually doesn’t matter – then take steps to remove it anyway so your bad warnings don’t get lost in the mix.
Tags: iphone dev, objective-c. No Comments »