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
1 answer

Cancelling NSOperation and removing it from queue immediately

So I've been thinking about this for a few days, and I can't seem to find a good way to make it work. I have an NSOperationQueue that allows only ONE operation at a time. I understand from the documentation : In OS X v10.6 and later, canceling an…
ItsASecret
  • 2,589
  • 3
  • 19
  • 32
3
votes
1 answer

Clarifications needed for concurrent operations, NSOperationQueue and async APIs

This is a two part question. Hope someone could reply with a complete answer. NSOperations are powerful objects. They can be of two different types: non-concurrent or concurrent. The first type runs synchronously. You can take advantage of a…
Lorenzo B
  • 33,216
  • 24
  • 116
  • 190
3
votes
3 answers

NSOperationQueue with a timer

I would like to use an NSOperationQueue which has got a timer inside it. For example - I download 1 element (complete the 1st NSOperation) then I want to wait for 3 seconds before the compiler goes on to the next operation. After the 2nd NSOperation…
Sergey Grischyov
  • 11,995
  • 20
  • 81
  • 120
3
votes
2 answers

iOS best practices to guarantee user has most recent updates to core data

For a simple note application, there is a table view controller with a fetchedResultsController that has a list of saved notes in core data. The user can either click the + button to add a new note or click on one of the records in the table view…
3
votes
1 answer

NSOperationQueue that pauses between operations?

I want to make an NSOperationQueue that pauses a certain length of time between operations. It is hitting a remote server and I want to make sure that I don't overload it with too many operations all at once. I already have set…
Jason
  • 14,517
  • 25
  • 92
  • 153
3
votes
2 answers

NSOperation deadlocks and blocks NSOperationQueue

I use a subclass of NSOperation to upload large files to AWS S3 using Amazon's iOS SDK (v1.3.2). This all works fine, but some beta testers experience deadlocks (iOS 5.1.1). The result is that the NSOperationQueue in which the operations are…
Bart Jacobs
  • 9,022
  • 7
  • 47
  • 88
3
votes
1 answer

AFNetworking: interrupt background requests for higher priority requests

Using AFNetworking, I need to download ~100 images in the background and store them to disk while ensuring any other network connectivity in my app takes precedence. ~~~~~~~ I've got an application that has 4 tabs. Each tab basically does the same…
3
votes
2 answers

Massive Mutithreading Operations

EDITED WITH NEW CODE BELOW I'm relatively newbie on Multithreading but to achieve my goal, doing it quickly and learning something new, I decided to do it using a multithread App. The goal: Parse a huge amount of string from a file and save every…
3
votes
2 answers

NSOperation & Singleton: Correct concurency design

I need an advice from you guys on the design of my app here, basically I would like to know if it will work as I expect ? As the multi-threading is quite tricky thing I would like to hear from you. Basically my task is very simple -I've…
deimus
  • 9,565
  • 12
  • 63
  • 107
3
votes
2 answers

Crashing in observeValueForKeyPath which attached to NSOperationQueue operationsCount

I have UITextView logView (tried both atomic and nonatomic) and NSOperationQueue uploadQueue properties in my UIView subclass. I've added KVO on my NSOperationQueue property's operationsCount like this: [[self uploadQueue] addObserver:self …
folex
  • 5,122
  • 1
  • 28
  • 48
2
votes
1 answer

iOS 5 NSURLConnection with NSOperationQueue - Providing UI Feedback

I need to make multiple NSURLConnections to a JSON Web Service. I would like each WS call to keep in UI informed, probably with a UIActivityIndicatorView and label. So far I've created a NSURLConnection helper class to handle the connection and…
Allen
  • 1,165
  • 2
  • 11
  • 23
2
votes
2 answers

using NSOperationQueue and blocks

I am having a little trouble using addoperationwithblock in Cocoa. Let's say I have a master function -(IBAction) callthisone { // Call another function "slave" here and store returned value in result result = return value from slave …
cocoacoder
  • 381
  • 8
  • 19
2
votes
3 answers

NSOperationQueue and Dispatch Queue as replacement of NSThread performing a repetitive task

I have an application in which I am repetitively calling a method in background. I implemented this by following below steps: created a background thread, called the appropriate method on the created thread, called sleep method on the thread, and…
Devarshi
  • 16,440
  • 13
  • 72
  • 125
2
votes
0 answers

Yield with NSThread?

I have an NSOperationQueue and I want to cancel some operations. Therefore I iterate over the operation and cancel some tasks. At another point in the code which is executed subsequent in the same (UI) thread I check how many operations are in the…
2
votes
2 answers

How to check if NSOperationQueue is finished and if any operation failed?

I'm trying to parse some XML files in the background so that the UI doesn't freeze. I have to check two things: NSOperationQueue is finished? NSOperation - parsing did fail? I have a class that subclasses NSOperation and a delegate is called if…
MoFuRo
  • 231
  • 5
  • 16