• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: capturing self is likely to lead to a retain cycle ..
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Prev by Date: Re: NSDateFormatter not working on iOS 5.
  • Next by Date: Re: About iVars declaration and property
  • Previous by thread: Re: capturing self is likely to lead to a retain cycle ..
  • Next by thread: NSBitmapImageRep and alpha channel
  • Index(es):
    • Date
    • Thread