Re: capturing self is likely to lead to a retain cycle ..
Re: capturing self is likely to lead to a retain cycle ..
- Subject: Re: capturing self is likely to lead to a retain cycle ..
- From: Matt Neuburg <email@hidden>
- Date: Tue, 15 Nov 2011 07:35:37 -0800
This is *very* well explained in the WWDC 2011 video on Objective-C advances. m.
On Sat, 12 Nov 2011 16:14:31 +0800, Roland King <email@hidden> said:
>
>With the code below I'm getting a warning "Automatic Reference Counting Issue: Capturing 'self' strongly in this block is likely to lead to a retain cycle"
>
>
>-(BOOL)textFieldShouldReturn:(UITextField*)textField
>{
> [ foo setTopicName:[ textField text ] completionHandler:^(BOOL)success{
>
> if( !success )
> {
> // present an alert sheet
> }
> else
> {
> // onCancel is also the callback from the 'cancel' button and dismissed this modally presented viewcontroller
> [ self onCancel:nil ]; // <-- ARC not too happy with this
> }
> } ];
>}
>
>
--
matt neuburg, phd = email@hidden, <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@hidden)
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:
This email sent to email@hidden