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

Cancelling NSOperation from NSOperationQueue cause crash

I'm trying to build a download manager class that packets all the async download (every op has its own thread) operation in an NSOperation subclass to add them later in an NSOperationQueue. The download manager class (a singleton) also exposes few…
Andrea
  • 26,120
  • 10
  • 85
  • 131
3
votes
1 answer

NSOperationQueue with reserve capacity?

Typically NSOperationQueue guarantees thats that tasks with low priorities will not be executed until tasks with high priorities are done executing. However, when a large number of operations are added quickly to the queue, sometimes the operation…
Tony
  • 36,591
  • 10
  • 48
  • 83
3
votes
1 answer

NSFetchedResultsController on main thread ignoring saves to Core Data from a different thread?

I have an NSFetchedResultsController on the main thread. Also from the main thread, I asynchronously send out a network request for JSON. When that JSON string returns, I start an NSOperation that inits a new (background) NSManagedObjectContext,…
3
votes
3 answers

Pushing multiple views onto a stack without seeing the ones inbetween

I am trying to give my application a feeling of persistance when switching between multiple parts of the application. When they tap on an icon I want it to open directly to the view controller that I was on however, I need to get the View…
endy
  • 3,872
  • 5
  • 29
  • 43
3
votes
2 answers

Running NSTimer in NSOperationQueue thread

I'm trying to run an NSTimer on a thread set up by an NSOperationQueue -(void)apiCallbackQueueManager:(NSString *)callid :(NSString *)service:(NSString *)action:(NSString *)data{ SEL theSelector = @selector(apiCallbackQueueTimer: service: action:…
Phil John
  • 1,225
  • 1
  • 15
  • 24
3
votes
1 answer

iOS - Background processes and UI update

the question is simple : my app control if there is an update every time it starts. If there is an update a popup will be shown with a Yes or No choose. When user tap Yes 4 methods start. These methods download xml file and upload CoreData. This is…
Andrea Mario Lufino
  • 7,921
  • 12
  • 47
  • 78
3
votes
2 answers

How to remove/cancel NSInvocationOperation from NSOperationQueue?

Both of the following questions are being asked in context to maintain NSOperationQueue and NSInvocationOperation. As I have used this concept to download multiple videos, how do I remove/release added NSInvocationOperation from NSOperationQueue…
alloc_iNit
  • 5,173
  • 2
  • 26
  • 54
3
votes
4 answers

NSOperation finished

I have an NSOperation running in a NSOperationQueue. The NSOperation downloads some data and parses it into NSDictionary. How do I know when the NSOperation has finished and get that dictionary? Thanks.
user635064
  • 6,219
  • 12
  • 54
  • 100
3
votes
1 answer

How to run an asynch process in an NSOperation

I have a need to update some data from a webservice via a background thread in an app I'm working on. Normally I'd just do this via an NSOperationQueue and a synchronous web request in the main() function of the NSOperation. However, for this…
cpjolicoeur
  • 12,766
  • 7
  • 48
  • 59
3
votes
2 answers

Setting backpressure in OperationQueue (or alternative API, e.g. PromiseKit, Combine Framework)

I have 2 steps in processing pipeline which runs over many images: Step 1: Load locally (or download) image (IO bound) Step 2: Run machine learning model (CPU/ GPU/ Compute bound/ single threaded because the model is big). How do I limit the number…
Ben Butterworth
  • 22,056
  • 10
  • 114
  • 167
3
votes
0 answers

NSOperationQueue setSuspended Crash iOS

I am having problems debugging a recent crash. I manage to get some feedback from Firebase but I am not able to replicate the conditions. The crash happens when I press the home button and come back into the app some times. Here is the stack trace…
PoolHallJunkie
  • 1,345
  • 14
  • 33
3
votes
1 answer

How to suspend dispatch queue inside for loop?

I have play and pause button. When I pressed play button, I want to play async talking inside for loop. I used dispatch group for async method's waiting inside for loop. But I cannot achieve pause. startStopButton.rx.tap.bind { if self.isPaused…
sametbilgi
  • 582
  • 2
  • 7
  • 29
3
votes
1 answer

Completion block is getting triggered even before my operation completes in main method

I am trying to create user in firebase using OperationQueue and Operation. I placed the Firebase Auth call in operation main method. Completion block of the operation is getting triggered even before firebase registration process is…
3
votes
1 answer

NSUrlConnection in multiple NSOperation instances in a NSOperationQueue

The following code adds multiple NSOperation instances in an NSOperationQueue. The Operation just takes the contents of a url. I'm providing the php code too... Given the following code... -(void)requestResponse { NSURLRequest *req =…
Vassilis
  • 2,878
  • 1
  • 28
  • 43
3
votes
3 answers

Delegate becomes nil in Operation of urlSession. How to keep delegate variable in separate thread?

I'm using an OperationQueue to upload files one by one to a remote server using URLSession.dataTask. A delegate is used to update a progress bar but after implementing OperationQueue my delegate becomes nil. It worked without OperationQueues.…
Andrew
  • 43
  • 7