Re: NSOperationQueue and for-loop
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