• 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: ARC, blocks, capture variables
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ARC, blocks, capture variables


  • Subject: Re: ARC, blocks, capture variables
  • From: Quincey Morris <email@hidden>
  • Date: Sun, 27 Sep 2015 18:03:27 -0700
  • Feedback-id: 167118m:167118agrif8a:167118sGY9JgRGVV:SMTPCORP

On Sep 27, 2015, at 17:17 , Scott Ribe <email@hidden> wrote:
>
> But I know that it does not result in a retain cycle, because I nil out fun at the appropriate time. So how to get rid of the warning?

IIRC you can simply assign ‘self’  to a local variable just before assigning to ‘fun', and use the local variable name instead of ‘self’ inside the block.

The other approach I’ve used, when I have control the signature of the block, is to pass ‘self’ as a parameter to the block invocation. This may actually avoid the reference cycle completely.



_______________________________________________

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


  • Follow-Ups:
    • Re: ARC, blocks, capture variables
      • From: Scott Ribe <email@hidden>
References: 
 >ARC, blocks, capture variables (From: Scott Ribe <email@hidden>)

  • Prev by Date: Re: o Swift generics, y no can I haz u dispatch correctly?
  • Next by Date: Re: ARC, blocks, capture variables
  • Previous by thread: ARC, blocks, capture variables
  • Next by thread: Re: ARC, blocks, capture variables
  • Index(es):
    • Date
    • Thread