0
votes

I have used ARC and built apps before that supported iOS 4.3, but as soon as I started using weak, because a Tree has a strong reference to node, and node has a reference back to the tree, which should be a weak reference:

@property (weak, nonatomic) NSTree *treeThatIBelong;

(NSTree is a class that I created in my own code).

In this case, the target of iOS 4.3 cannot be used, as the compiler error is "weak... is not supported in the deployment target", and the error will only go away if it is iOS 5.0 or higher. So if we have a weak, we can't deploy to iOS 4.3? Is there a workaround if we want to support iOS 4.3 and still use ARC?

1

1 Answers

1
votes

The workaround is to not use weak if you need to deploy to iOS 4.3 or earlier. weak requires runtime support that's not present until iOS 5.0.

For iOS 4.3 and earlier you can use assign, which of course is not a zeroing weak reference and therefore just turns into garbage when the referenced object is deallocated. Which is exactly what you have to deal with already when using MRR instead of ARC.