My app must support iOS 3.1.2
But it looks like __weak, __block and __unsafe_unretained are only for newer versions of iOS
Can someone show me an example of how to declare a weak reference in for iOS 3.1.2?
Should I just do:
@interface foo
{
SomeType* _bar
}
@property (nonatomic, assign) Sometype* bar;
@end
@implementation
@synthesize bar = _bar;
@end
Assign, as you have used it, is the same as unsafe_unretained.
As you noted, you cannot declare something as weak before iOS5 (which cleans up a reference for you).
So basically when you are using an assign reference just be careful to clear out any assign references when the object is slated to go away.
At this point there is no value in supporting iOS 3.x. You should convince whoever you are working for to move away from it, if only to use ARC. It will make lots of memory issues and potential crashes go away.