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
7
votes
2 answers

Calling -(void) cancelAllOperations on NSoperationQueue is not setting the isCancelled property of NSOperation that is present inside the Queue

I am facing problem related to NSoperationQueue. In my code in : -(void) viewDidLoad { //Initialisation of queue and operation. //adding operation to queue [self.operationQueue addOperation:op]; } -(void)…
kidsid49
  • 1,358
  • 3
  • 18
  • 37
7
votes
3 answers

NSOperationqueue background, download images

I created a NSOperationQueue to download images (from Twitter for Cell): NSOperationQueue *queue = [[NSOperationQueue alloc]init]; [queue addOperationWithBlock:^{ NSString *ImagesUrl = [[NSString…
7
votes
2 answers

C++ equivalent for NSOperation and NSOperationQueue

Please advise me to how to achieve NSOperation and NSOperationQueue functionality in C++.
user1908860
  • 509
  • 1
  • 9
  • 19
7
votes
5 answers

iphone - Should I use NSOperationQueue and NSOperation instead of NSThread?

I am facing a design problem of my app. Basically, the followings are what I am going to do in my app. A single task is like this: Read custom object from the underlying CoreData databse Download a json from a url Parse the json to update the…
Jackson Tale
  • 25,428
  • 34
  • 149
  • 271
6
votes
4 answers

NSOperation inside NSOperationQueue not being executed

I really need help here. I'm desperate at this point. I have NSOperation that when added to the NSOperationQueue is not being triggered. I added some logging to see the NSOperation status and this is the result: Queue operations count = 1 Queue…
Martin Garcia
  • 345
  • 5
  • 14
6
votes
8 answers

Understanding sequence of operations with dependency in Swift

Referring https://developer.apple.com/reference/foundation/operation, I am having Playground setup as - class myOperation1 : Operation { override func main() { print("op1 working....") } } class myOperation2 : Operation { …
BaSha
  • 2,356
  • 3
  • 21
  • 38
6
votes
4 answers

Crashing with ASIHTTPRequest and NSOperationQueue when cancelling operations

I'm having a really hard time when trying to cancel requests in an NSOperationQueue. Before deallocating my 'engine' object, I call a cancelOperations method to cancel everything in the queue, so this will include in flight ASIHTTPRequests and…
mootymoots
  • 4,545
  • 9
  • 46
  • 74
6
votes
3 answers

How to resume time out operations NSOperationQueue in iOS?

I have already implemented NSOperationQueue successfully in application. I have one operation queue which might have 1000 of NSOperations like below. @interface Operations : NSOperation @end @implementation Operations - (void)main { NSURL…
Jayeshkumar Sojitra
  • 2,501
  • 4
  • 31
  • 44
6
votes
1 answer

NSBlockOperation, NSOperationQueue and Blocks

I have to sync a bunch of information from my RestAPI. I must do 6 RestAPI calls to complete work. I designed API calls with Blocks, and return NSError if there is any. 3 of these calls should to execute nested because the first call gives…
6
votes
4 answers

Can I cancel a Block added to an NSOperationQueue with addOperationWithBlock:?

I've read many many articles which say "BLOCKS ARE THE FUTURE!!!". I'm wondering if it relates to running operations in the background. For example, I have a table view which has images that will come from the web. Right now I can get them using…
6
votes
1 answer

using [NSOperationQueue mainQueue] in XCTests

I'm testing a part of my code using using XCTest that also adds NSOperations on the main queue. It looks like this: [NSOperationQueue mainQueue] addOperationAsBlock:^{ // some code happens here }]; The code runs when running the app on a device or…
shaioz
  • 340
  • 3
  • 12
6
votes
2 answers

When will completionBlock be called for dependencies in NSOperation

From the docs: The completion block you provide is executed when the value returned by the isFinished method changes to YES. Thus, this block is executed by the operation object after the operation’s primary task is finished or cancelled. I'm…
6
votes
3 answers

What does isConcurrent mean for NSOperation running from NSOperationQueue?

Because NSOperationQueue always run tasks on a new thread, I'm confused about the role of isConcurrent when NSOperation runs from NSOperationQueue. If i have two subclasses of NSOperation, both running an async processes, both are launched from…
amit
  • 2,171
  • 4
  • 31
  • 50
6
votes
3 answers

Asynchronous url requests inside dispatch_async

I am trying to implement asynchronous url requests in a particular function, I want all these requests to complete and then do a particular action but the action precedes the requests i.e, it is getting called before the requests…
Satheesh
  • 10,998
  • 6
  • 50
  • 93
6
votes
3 answers

Set priority to an NSOperationQueue

GCD enables dispatching blocks to a queue according to 4 global priority queues (high, default, low, background). I have several NSOperationQueues in my app but want to run each in different priority. As i understood NSOperationQueue is an…
user2261801
  • 61
  • 1
  • 2