NSOperationQueue and for-loop
NSOperationQueue and for-loop
- Subject: NSOperationQueue and for-loop
- From: Koen van der Drift <email@hidden>
- Date: Tue, 02 Oct 2012 17:49:51 -0400
Hi,
When looking how to implement an NSOperationQueue with a loop, I found several examples that have the following structure:
NSInteger i;
for ( i = 0; i < 1000; i++ ) {
[queue addOperationWithBlock:^{
i += 1;
}];
}
But I get a compiler error: Variable is not assignable (missing __block type specifier)
I solved by declaring the declaration for i:
NSInteger __block i;
But why does it work in the examples I found?
Thanks,
- 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