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

Alternatives to GCD to run code with a delay under SwiftUI

Swift 5, iOS 13 I am running this code, it works. var body: some View { ... Button(action: { self.animateTLeft() quest = quest + "1" }) { Wedge(startAngle: .init(degrees: 180), endAngle: .init(degrees: 270)) .fill(Color.red) …
2
votes
1 answer

'progress' property of OperationQueue not working in iOS 13

iOS 13 introduced the progress property in the OperationQueue class. At the same time Apple marked the operations and operationCount properties as deprecated which indicates they should not be used anymore for reporting progress on a queue. My…
The Lone Coder
  • 3,062
  • 4
  • 20
  • 35
2
votes
2 answers

Correct way to release object which implements NSOperationQueue and Asynchronous requests

I'm struggling to figure out a solution to my problem, I have a Download class which handles calls to my api, these calls are added to a NSOperationQueue. Each call is assigned a completed and failed notifier which post's when the call completes or…
Alex
  • 2,513
  • 5
  • 27
  • 42
2
votes
2 answers

Completion handlers and Operation queues

I am trying to do the following approach, let operationQueue = OperationQueue() operationQueue.maxConcurrentOperationCount = 10 func registerUser(completionHandler: @escaping (Result) -> Void) -> String { self.registerClient()…
Perseus
  • 1,546
  • 4
  • 30
  • 55
2
votes
2 answers

NSOperationQueue operations and operationsCount deprecated. How to cancel operations of a specific class?

This documentation says that operations is deprecated with no hint of a replacement function: https://developer.apple.com/documentation/foundation/nsoperationqueue/1415168-operations?language=objc Xcode lists a possible replacement as…
Trygve
  • 1,317
  • 10
  • 27
2
votes
3 answers

Async tasks execution with dependency

Situation: I have 2 tasks says T1 & T2 in async background mode. T2 depends on T1 and have successBlock which is executes after the completion of the both tasks T1 & T2. Quick diagram is below for better understanding. Edit: To better…
dahiya_boy
  • 9,298
  • 1
  • 30
  • 51
2
votes
1 answer

NSOperation & NSOperationQueue freezing application

I am using NSOperationQueue and NSOperation to perform requests to twitter. However when I am performing this request, and receiving results, the application freezes for a few seconds until all the results have been downloaded. Is there a way to…
max_
  • 24,076
  • 39
  • 122
  • 211
2
votes
2 answers

How to make multiple Alamofire requests with operation query

I have an app that uploads multiple images to the server using Alamofire. Each image needs an upload token before uploading to the server. So, in a for loop, for every image file, I make a get request via Alamofire to get the upload token After…
Nilay Dagdemir
  • 236
  • 2
  • 15
2
votes
1 answer

Crashlytics Crash with NSOperationQueue (QOS: UNSPECIFIED)

I'm getting a crash, reported in Crashlytics, and I have no idea how to reproduce the error, It happens randomly so it's hard to debug it with Xcode. Any ideas? Crashed: NSOperationQueue 0x280419200 (QOS: UNSPECIFIED) 0 libobjc.A.dylib 0x22c471430…
Bruno Henrique
  • 131
  • 4
  • 11
2
votes
2 answers

NSOperationQueue and UITableView

I'm loading some data from a SQLite database to be displayed in a UITableView. To make sure the user is not blocked and the table is displayed quickly I'm creating a queue and adding the database operation to be executed in the background. The add…
Amir
  • 33
  • 5
2
votes
0 answers

Download with URLSession and Operation queue does not start next operation when application is in background

Use case : Download file from a server via one API which will give the download server url(download server url vality is for 10 secs only). I have enabled the background capabilities. Then created one Download Manager which holds the OperationQueue…
2
votes
0 answers

Let NSOperation Wait for CoreBluetooth Write Confirmation?

I wish to queue CoreBluetooth writes using NSOperation: class BtWriteOperation: Operation { private let data: Data private let characteristic: CBCharacteristic private let peripheral: CBPeripheral private let…
meaning-matters
  • 21,929
  • 10
  • 82
  • 142
2
votes
0 answers

Core Image filter intermittently crashes when running in a NSOperation

I have a simple Core Image filter running in a NSOperation. It works most of the time, but, every now and then it will crash (the rest of the code never crashes that doesn't use Core Image). When it crashes, it always has the same backtrace pointing…
Jeshua Lacock
  • 5,730
  • 1
  • 28
  • 58
2
votes
2 answers

EXC_BAD_ACCESS while adding data to array, using 2 NSOperations simultaneously

I have: 1) Starting 2 asynchron NSUrlRequests simultaneously 2) As soon as one of the two requests has loaded XML data, an NSOperationQueue is used to start a XML parser. Hereby, the ParseOperations work excatly as in Apple's LazyTableImages…
2
votes
3 answers

iOS swift Operation Queue

I am working on iOS app where I am using OperationQueue. I have created 2 operations. Operation2 is dependent on completion of Operation1.Operation2 needs to wait until Operation 1 get finished if its running. If operation 1 is not running then…
Kapil
  • 133
  • 2
  • 11