Questions tagged [nsoperationqueue]

On Mac OS X, the NSOperationQueue class regulates the execution of a set of NSOperation objects.

The NSOperationQueue class regulates the execution of a set of NSOperation () objects. After being added to a queue, an operation remains in that queue until it is explicitly canceled or finishes executing its task. Operations within the queue (but not yet executing) are themselves organized according to priority levels and inter-operation object dependencies and are executed accordingly. An application may create multiple operation queues and submit operations to any of them.

References:

1047 questions
4
votes
1 answer

Objective-C wait for asynchronous operation and enqueue completion handlers

I have to calculate a costly value. After this value is computed, I'd like to run a completion handler block: -(void) performCostlyCalculationWithCompletionHandler:(void (^)(void)complete { …
bcattle
  • 12,115
  • 6
  • 62
  • 82
4
votes
1 answer

iPhone: NSOperationQueue running operations serially

I have a singleton NSOperationQueue that handles all of my network requests. I'm noticing, however, that when I have one particularly long operation running (this particular operation takes at least 25 seconds), my other operations don't run until…
Greg Maletic
  • 6,225
  • 8
  • 54
  • 73
4
votes
1 answer

Are NSOperationQueues retained automatically while running?

This is probably an easy one, but I did a couple quick searches and couldn't find the answer. Do I have to retain an NSOperationQueue (by using property etc) to avoid having it be released after a method finishes execution. For example: -…
mrosales
  • 1,543
  • 11
  • 18
4
votes
2 answers

NSOperation. Cancellation vs Complete status

I have an NSOperation with an NSOperationQueue that has a bunch of child operations, some queued up. I had a problem where even after calling cancelAllOperations on the queue my main method was hanging on waitUntilAllOperationsAreFinished. Then when…
Mitchell Currie
  • 2,769
  • 3
  • 20
  • 26
4
votes
0 answers

Objective-c simple polling

I'm new to objective-c and I'm building an app that requires a background polling to a generic API to refresh some data on my user interface. After several hours looking for an answer/example that fits my problem I came across some solutions like…
4
votes
3 answers

How do I start an Asynchronous NSURLConnection inside an NSOperation?

I want to do an Asynchrous NSURLConnection inside of an NSOperation on a background thread. it is because I'm doing some very expensive operations on the data as they come back. This is a very similar question to what they asked here: How do I do an…
Guy Kahlon
  • 4,510
  • 4
  • 30
  • 41
4
votes
3 answers

Is [NSOperationQueue mainQueue] guaranteed to be serial?

That is, if we queue the same thing several time there will be no concurrency. The one we queued first will be executed first. I mean there is only one main thread right?
user4951
  • 32,206
  • 53
  • 172
  • 282
4
votes
2 answers

Queue of NSOperations and handling application exit

I'm about to create a series of NSOperations and run them in a queue. They will all be sequential and run one at a time. These operations will fetch data from the web and create and save core data managed objects. How do I handle the situation where…
Michael Waterfall
  • 20,497
  • 27
  • 111
  • 168
4
votes
1 answer

Why NSOperationQueue is faster than GCD or performSelectorOnMainThread when they process a large number of tasks on the main Thread?

for example, i have 100 times the for loop. and need to update UIImageView,and the last 2 method is same slowly. why? what is the different between they? //fastest [[NSOperationQueue mainQueue] addOperationWithBlock:^{ …
4
votes
1 answer

Granularity status of an NSBlockOperation

I have extended NSOperationQueue to allow adding NSBlockOperation with a specific NSString as identifier. The identifier value is held in a NSMutableArray serving as a registry. This is how I implement the registry. -(void)addOperation:(NSOperation…
Leonardo
  • 9,607
  • 17
  • 49
  • 89
4
votes
1 answer

Display download queue from Core Data in UITableView

I want to download a certain amount of data from a server based on Core Data local database that contains links to the content. I then want to have a table view that would dynamically display the content being downloaded one by one in a queue…
Sergey Grischyov
  • 11,995
  • 20
  • 81
  • 120
4
votes
1 answer

NSOperationQueue and background support

I have some problems on elaborating a useful strategy to support background for NSOperationQueue class. In particular, I have a bunch of NSOperations that perform the following actions: Download a file from the web Parse the file Import data file…
Lorenzo B
  • 33,216
  • 24
  • 116
  • 190
4
votes
2 answers

Building up UIViews on background thread

I'm aware that the UI should only be updated on the main thread, but is it possible to create and add subviews on a separate thread, as long as they are not added to the visible view? Will it cause memory and performance issues? Here's some example…
cannyboy
  • 24,180
  • 40
  • 146
  • 252
4
votes
3 answers

How can I know when nsoperation queue has completed all requests so that I can reload my tableview?

I am downloading data from different links using ASIHTTPRequest and NSOperationQueue to download in background thread. When a request has finished i parse in using requestFinished delegate method of ASIHTTPRequest. I want to update the data in…
iMemon
  • 1,095
  • 1
  • 12
  • 21
3
votes
1 answer

AFNetworking setUploadProgressBlock not behaving goes straight to 100%

I am using the AFNetworking Framework to facilitate photo uploads to a website. The uploads work fine, but I need to show progress in a UIProgressView. Problem is, the progress moves from 0 to 100% a second or so after the upload starts and sits…
HackyStack
  • 4,887
  • 3
  • 22
  • 28