Questions tagged [nsoperation]

The NSOperation class is an abstract class you use to encapsulate the code and data associated with a single task

The NSOperation class is an abstract class you use to encapsulate the code and data associated with a single task. Because it is abstract, you do not use this class directly but instead subclass or use one of the system-defined subclasses (NSInvocationOperation or NSBlockOperation) to perform the actual task. Despite being abstract, the base implementation of NSOperation does include significant logic to coordinate the safe execution of your task. The presence of this built-in logic allows you to focus on the actual implementation of your task, rather than on the glue code needed to ensure it works correctly with other system objects.

An operation object is a single-shot object—that is, it executes its task once and cannot be used to execute it again. You typically execute operations by adding them to an operation queue (an instance of the NSOperationQueue class). An operation queue executes its operations either directly, by running them on secondary threads, or indirectly using the libdispatch library (also known as Grand Central Dispatch). For more information about how queues execute operations, see NSOperationQueue Class Reference.

If you do not want to use an operation queue, you can execute an operation yourself by calling its start method directly from your code. Executing operations manually does put more of a burden on your code, because starting an operation that is not in the ready state triggers an exception. The isReady method reports on the operation’s readiness.

http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/NSOperation_class/Reference/Reference.html

983 questions
-1
votes
3 answers

How to make Thread paused or stopped when view disappear

How to make Thread paused or stopped when view dispear i do that: - (void)viewDidDisappear:(BOOL)animated { [super viewDidDisappear:(BOOL)animated]; [NSThread sleepForTimeInterval:10]; } but didnt work
Med Reda
  • 36
  • 1
  • 5
-1
votes
1 answer

Several redeclaration errors occur when AFDownloadRequestOperation is added

When I add AFDownloadRequestOperation I get several errors that result in the inability for me to successfully build my project... These errors all seem to be of a redeclaration nature. My first mind is to go into the files that display the error…
davetw12
  • 1,815
  • 2
  • 20
  • 27
-2
votes
1 answer

What is ideal way to use multi threading with Core Data?

How to use multithreading with blocks and NSOperation and NSOperationQueue so that there are no problems with concurrency?
-2
votes
1 answer

Get UIImageView animation for at least one cycle before terminating

I'm new to Objective C and X-code and I'm having trouble getting my UIImageView animation to stay on screen for at least one complete cycle. I am using it as a custom wait animation for when a button is tapped and a bunch of saving and processing…
-3
votes
1 answer

NSoperation - string not visible outside the block

I am currently working on a project and using tesseract API . The code is following : UIImage *bwImage = [image g8_blackAndWhite]; [self.activityIndicator startAnimating]; // Display the preprocessed image to be recognized in the…
Guri S
  • 1,083
  • 11
  • 12
-3
votes
1 answer

Notifications when NSOperation finishes?

Other questions and answers on Stack Overflow speak of observing the operations.count, adding a "Done Operation" etc. GCD finishedHow do I know all my tasks in Grand Central Dispatch finished? NSOperationQueue finishes operations KVO for monitoring…
quantumpotato
  • 9,637
  • 14
  • 70
  • 146
-3
votes
1 answer

iOS method crashes when it's called while it's already running (using NSOperationQueue)

I've a UIViewController that contains a UITableView and when I call the method "requireObjects", this last populate the arrays to configure the table. I state that the cellForRowAtIndexPath method work properly and dequeue a number of cells based on…
Pinturikkio
  • 1,490
  • 1
  • 14
  • 28
-4
votes
2 answers

NSOperationQueue background process in iPhone?

I am new in NSOperationQueue, I need to call web-service in background process using NSOperationQueue, how to do that, please help me. I have spend more time for this. Thanks in Advance
SampathKumar
  • 2,525
  • 8
  • 47
  • 82
1 2 3
65
66