• 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: NSOperationQueue and for-loop
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSOperationQueue and for-loop


  • Subject: Re: NSOperationQueue and for-loop
  • From: Koen van der Drift <email@hidden>
  • Date: Tue, 02 Oct 2012 20:43:58 -0400

On Oct 2, 2012, at 6:19 PM, Koen van der Drift <email@hidden> wrote:

>
> On Oct 2, 2012, at 6:07 PM, email@hidden wrote:
>
>> I can't speak to the other examples since I haven't seen them, but the __block specifier is necessary if your block modifies the variable (your block does modify i). Your example also seems a bit strange since your for loop modifies i itself.
>
> Ha, yes you are right, that was a quick copy-paste error. I of course want something like: sum += i ;-)
>
> I didn't know about the part when a block modifies a variable. That makes sense, thanks.

Alright, I got it to work.

Now, of course I am not just doing a simple addition in the loop, I create objects, set some of their properties, do some calculations with them, and add them to an array.  Some of the objects are from my own project, but some of them are from a 3rd party framework. Should I add the __block to all the properties of these objects as well? I can do that for the objects from my own project, but the objects from the other framework are not ARC (my project is), and I get a crash at the dealloc method for these.

Is there a way to solve this?

Thanks again,

- Koen.


_______________________________________________

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: NSOperationQueue and for-loop
      • From: email@hidden
References: 
 >NSOperationQueue and for-loop (From: Koen van der Drift <email@hidden>)
 >Re: NSOperationQueue and for-loop (From: email@hidden)
 >Re: NSOperationQueue and for-loop (From: Koen van der Drift <email@hidden>)

  • Prev by Date: Safety of re-entering -[NSWindow makeFirstResponder:]?
  • Next by Date: Re: NSOperationQueue and for-loop
  • Previous by thread: Re: NSOperationQueue and for-loop
  • Next by thread: Re: NSOperationQueue and for-loop
  • Index(es):
    • Date
    • Thread