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
5
votes
3 answers

Using a single shared background thread for iOS data processing?

I have an app where I'm downloading a number of resources from the network, and doing some processing on each one. I don't want this work happening on the main thread, but it's pretty lightweight and low-priority, so all of it can really happen on…
5
votes
1 answer

Is it safe to enumerate through [NSOperationQueue operations]?

Is it safe to enumerate, via fast enumeration, through [NSOperationQueue operations]? Like so: for (NSOperation *op in [operationQueue operations]) { // Do something with op } Since operations are asynchronous and executed on another thread,…
Adam Ernst
  • 52,440
  • 18
  • 59
  • 71
5
votes
1 answer

Operation Queue not executing in order even after setting priority and dependency on Operations

I am making three api calls and want that API1 should execute first, once completed API2 should execute followed by API3. I used operation queue for this with adding dependency over operations. I tried setting priority as well but not getting api…
Shivam Tripathi
  • 1,405
  • 3
  • 19
  • 37
5
votes
1 answer

Using operation queues with combine framework

With the arrival of combine framework, is there a need to use operation queues anymore. For example, apple uses operation queues almost all over the place in WWDC app. So if we use SwiftUI with combine(asynchronous programming), will there be a need…
Reckoner
  • 1,041
  • 2
  • 13
  • 29
5
votes
2 answers

Obj-c - Delayed animation when returning to original state?

I'm using the below code to shift a view and my tableview up when my keyboard is activated. When the keyboard is closed however, it takes the upView a solid 2 seconds after the keyboard closes to return to where it was (the tableView on the other…
Brittany
  • 1,359
  • 4
  • 24
  • 63
5
votes
2 answers

encountering numerous leaks on iphone device when using NSOperationQueue and trying to change sliders / pickers etc

encountering numerous leaks on iphone device when using NSOperationQueue and trying to change sliders / pickers etc. I am able to change labels without an issue, but if I try to change a slider or picker both created on interface builder I get these…
5
votes
2 answers

Significant lag when loading image using UIImage from URL asynchronously

I am trying to write an iPad app that loads an image from a URL. I am using the following image loading code: url = [NSURL URLWithString:theURLString]; NSData *data = [NSData dataWithContentsOfURL:url]; img = [[UIImage alloc]…
Jackson
  • 3,555
  • 3
  • 34
  • 50
5
votes
1 answer

Setting main queue as underlying queue for NSOperationQueue

NSOperationQueue class has an underlyingQueue property which is used to set the dispatch queue on which NSOperation instances will be executed. let dispatchQueue = dispatch_queue_create("custom.queue", DISPATCH_QUEUE_SERIAL) let opQueue =…
Said Sikira
  • 4,482
  • 29
  • 42
5
votes
0 answers

Crash at NSOperationQueue addOperation Custom NSOperation

I have a NSOperationQueue, maxConcurrentOperationCount = 1, and Custom NSOperation has a property is block, when the NSOperationQueue addOperation, the app crash, in iOS 9.x, the NSOperation is not nil. following is Apple crash report, but i can't…
fyxrhyry
  • 135
  • 1
  • 8
5
votes
2 answers

Get specific NSOperation from NSOperationQueue

Hi there, In my app, I create NSOperations and I add them to a NSOperationQueue. Sometimes, I want to cancel some specific operations from my operation queue, that's why I have defined an identifier property for my NSOperation subclass : @property…
Randy
  • 4,335
  • 3
  • 30
  • 64
5
votes
1 answer

How to Cancel download in Queue using Swift

I have an app where user can download multiple files, sequentially. I have followed Mr. Rob's solution for the sequential downloads. However, I have problem when I try to cancel the download. There are two situation when I try to cancel the…
Syafiq Mastor
  • 178
  • 2
  • 10
5
votes
1 answer

Exactly when NSOperation is removed from NSOperationQueue on cancelling request?

I was going through some documents explaining how to manage NSOperation inside NSOperationQueue. My focus is to always do not execute the operation at all if the user pressed a cancel button in a progress panel or quit the application. And thus,…
5
votes
1 answer

NSOperationQueue : cancel an operation after a timeout given

Basically, I would like to perform a cancel if the operation I'm adding to the queue does not respond after a certain timeout : NSOperationQueue * queue = ... [self.queue addOperationWithBlock:^{ // my block... } timeoutInSeconds:5.0…
Nicolas Henin
  • 3,244
  • 2
  • 21
  • 42
5
votes
3 answers

sending More than 200 images to server in Multitasking Mode?

I want to upload 300 images to server through NSOperationQueue. I have to use one single URL for each image, so I will use 300 URLs. In other words 300 NSOperations for those URLs to push into NSOperationQueue. Is it Right Approach? Does not it…
user141302
5
votes
0 answers

iphone app crash bad access exception DataDetectorsCore processToken

My iphone app is crashing on ios 7.0 iphone 5s on client device i can't figure out what is wrong with it, I am using crashlytics for crash reporting. Crashlytics reporting crash due to bad access on thread #9 DataDetectorsCore processToken Crashed:…
Irfan Gul
  • 1,579
  • 13
  • 23