December 2013
Intermediate to advanced
132 pages
1h 58m
English
CHAPTER 27
![]()
Background Processing
Background Processing Defined
When your program needs to do more than one thing at a time, you can use background processing. Background processing in Objective-C is done with a Foundation class called NSOperationQueue.
NSOperationQueue manages lists of operations and decides how to schedule the resources needed to run an operation. Operations are blocks of code. Operations can execute simultaneously or one at a time.
Let’s say that you want to count to 10,000 while printing this out to the log. To do this, you would code something like the following:
for (int y=0; y<=10000; y++) { NSLog(@"y = %i", y);}
This ...
Read now
Unlock full access