2
votes

I'm writing app for iOS 4 with ARC. I'm presenting and dismissing modal view controllers through the standard delegate pattern. ARC in iOS 4 doesn't support weak references, so, I mark the child view controller's delegate property as assign. Should I set that delegate to nil in child view controller's dealloc method?

1
For iOS < 5.0 you ought to use unsafe_unretained instead of weak. I would set them to nil but have no documentation backup to say if this is neccesary or not in this exact case.Rok Jarc

1 Answers

2
votes

It shouldn't matter. Your child only uses the delegate to message the parent view controller. Your child view controller won't be making any calls to the parent after it is dealloc'ed, so you won't need to nil the delegate. By using assign or weak you haven't taken an ownership role with respect to the parent, so there is no need to nil the delegate for memory management.