__unsafe_unretained in ARC

Hi experts,

I'm using ARC for the first time and I have a problem with delegates.

I have a ConnectionObject that inherits from NSObject, it has a NSURLConnection and downloads some data. I have a protocol ConnectionObjectDelegate with several delegate methods that need to be called when the connection finished downloading.
 It also has an NSMutableSet containing delegates that need to be called when the connection finishes. The objects I add to this set as delegates may become nil while the data is downloading, so they have to be removed/become nil in the set (or before trying to call the delegate method) as well.

My object has a method for adding a delegate, in the past this would have been:
-(void)addDelegate:(id<ConnectionObjectDelegate>)delegate;

But now I'm not sure, how do I make sure that the object I pass as a parameter is weak?

Thanks in advance.
LVL 2
SnapplesAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

pgnatyukCommented:
The delegate was always "assign". So we ARC it should be:
@property (weak) id <MyDelegate> delegate;
I think so.
An interesting post about ARC
http://vinceyuan.blogspot.com/2011/06/wwdc2011-session-323-introducing.html

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SnapplesAuthor Commented:
Yes, I get that, and that is the perfect solution for iOS5, but my app supports iOS4 and above, where weak isn't available.
0
pgnatyukCommented:
I still use assign for the delegates and do not support ARC in my apps.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
iOS

From novice to tech pro — start learning today.