On Wed, 04 Jan 2012 00:26:17 +0800, Roland King <[email protected]> said:
>I have this line of code, just before a block is enqueued onto a dispatch 
>queue. weakSelf is used in that block. 
>
>       RKHIPCard __weak *weakSelf    = self;
>
>which is generating the following error 
>
>       objc[15245]: cannot form weak reference to instance (0x89b4100) of 
> class RKHIPCard
>
>in certain very occasional circumstances. A bit of logging and it's clear that 
>those circumstances are when the RKHIPCard, self, is in the middle of being 
>deallocated.

Watch the WWDC 2011 video again; you're explicitly told that this is exactly 
why the weak-strong dance includes a nil test against the strong self inside 
the block. m.

--
matt neuburg, phd = [email protected], <http://www.apeth.net/matt/>
A fool + a tool + an autorelease pool = cool!
Programming iOS 4!
http://www.apeth.net/matt/default.html#iosbook_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to