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

Store a NSOperation with Core Data

I need to add persistency to an NSOperationQueue, so the user can close my application without lose any data. I'm a big fan of core data, so I'm looking for a way to store my NSOperation subclass on core data. Any advice?
IgnazioC
  • 4,554
  • 4
  • 33
  • 46
0
votes
1 answer

creating UI elements on NSOperationQueue non-main queues causes strange behavior

I had some code that created and added UIView subviews via a queue created by [[NSOperationQueue alloc] init], and it led to strangely laggy behavior. Subviews were only added after abnormally long delays. But then I switched to using…
dan
  • 43,914
  • 47
  • 153
  • 254
0
votes
1 answer

Objective c - Canceling operations in NSOperationQueue

I'm using AFNetworking AFHTTPClient just for the example, but this question is about NSOperationQueue in general. The AFHTTPClient manage an NSOperationQueue for requests made by the client. It also has a cancelAllOperations method that iterate…
Eyal
  • 10,777
  • 18
  • 78
  • 130
0
votes
1 answer

responds to selector but throws error

- (void)TargetHit:(int)target{ void (^threadBlock)(void) = ^{ NSLog(@"respond to selector %d", [self respondsToSelector:@selector(changeImageOfTarget:)]); [[NSOperationQueue mainQueue]…
geminiCoder
  • 2,918
  • 2
  • 29
  • 50
0
votes
0 answers

Stacktrace involving a NSOperation release

I receive crash reports which are quite obscure. What is the strategy with stack traces such as the following. Thread 7 crashed 0 libobjc.A.dylib objc_msgSend + 9 1 Foundation -[NSOperation release] + 148 2 Foundation __release_object_op + 22 3…
Kamchatka
  • 3,597
  • 4
  • 38
  • 69
0
votes
1 answer

Using NSOperationQueue as a view controller instance variable

If I have a view controller that has an NSOperationQueue as an instance variable, then what happens to any operations that are executing in the queue if the view controller gets unloaded?
John Topley
  • 113,588
  • 46
  • 195
  • 237
0
votes
1 answer

connection:didReceiveResponse: from NSURLConnectionDelegate never fired

I'm trying to get UIProgressView, NSURLConnection, NSOperation and NSOperationQueue working together. Here is the code: http://pastie.org/4080576 Problem: connection:DidReceiveData: never called: execution going immediately to -start(), through…
0
votes
1 answer

Resend ASIHTTPRequest when connection returns

I am using ASIHTTPRequest to interact with my website. I am basically adding ASIHttpRequests to a queue. It all works fine if there is an internet connection. However, I guess the operation gets deleted if the request fails (ie, no internet…
0
votes
2 answers

dealloc in NSOperation

i have a NSOperationQueue with NSOperation, in my NSOperation .h i have this property: @interface MyOperationClass : NSOperation @property (strong, nonatomic) NSFetchedResultsController *fetchedResultsController; @property (strong, nonatomic)…
Piero
  • 9,173
  • 18
  • 90
  • 160
0
votes
2 answers

Is this the right way to handle background thred?

I do a lot of request to the server: NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:urlString]cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0]; [theRequest setValue:@"gzip"…
BlackMouse
  • 4,442
  • 6
  • 38
  • 65
0
votes
1 answer

Multiple streams, 1 File?

I'd like write a file to disk using multiple NSOutputStreams (each one in a different thread). I know how to handle the threading issue, but I can't figure out what to use to write different byte-ranges to a single file at the same time. For…
0
votes
1 answer

NSOperationQueue waitUntillAllOperationsAreFinished blocks operations

I've created my own NSOperation subclass and now I want some of its instances to run in parallel. As it's a concurrent operation I've overwritten - (void)start { [self willChangeValueForKey:@"isExecuting"]; isExecuting = YES; [self…
Nickkk
  • 2,261
  • 1
  • 25
  • 34
0
votes
1 answer

NSOperation that will operate on UIView launches before layoutSubviews is called

Say I have a subclass of UIView which I will call AnimatableView, where my implementation of layoutSubviews lays out some internal content. AnimatableView also has the method commenceAnimationLoop which looks something like this: - (void)…
Barjavel
  • 1,626
  • 3
  • 19
  • 31
0
votes
2 answers

iPad app freezes during NSOperationQueue

I have a problem with an app where I implemented an NSOperationQueue. It seems that pressing the close button of the iPad makes the UI freeze. The app itself is still running in the background, the UI is updated, it's just that it won't answer to…
BBog
  • 3,630
  • 5
  • 33
  • 64
0
votes
2 answers

NSOperation subclass not calling delegate methods and NSOperationQueue not waiting until finished

I use this piece of code to create some NSOperations and add them to a queue: HUD = [MBProgressHUD showHUDAddedTo:self.navigationController.view animated:YES]; //HUD.labelText = @"Downloading.."; //HUD.dimBackground = YES; …
Jack Nutkins
  • 1,555
  • 5
  • 36
  • 71