I've run into an while trying to launch an NSTask from inside an NSOperation.
Here's a very simple app I've put together to showcase the problem. When you click the button, an NSOperation is queued. It sets up an NSRunLoop, and calls a method which invokes an NSTask. The task is really simple- it just launches /bin/sleep for two seconds...
I'm writing test cases for a wrapper class written around ASIHTTPRequest. For reasons I can't determine, my test cases complete with failure before the ASIHTTPRequest finishes.
Here's how the program flow works.
Start in my test case.
Init my http engine object, instruct it to create a new list
Create the new ASIHTTPRequest object and...
I have an iphone app where on the loading of a view controller, I want to call a web service , get and parse XML all on the background thread. Then update the ui after the thread is done, then fire off another thread to do a secondard operation in another background thread.
Sort of like chaining threading calls:
UI Thread -> Create BG...
What I Want
I've got an NSOperationQueue in my application and it's critical that all operations get processed before the application quits. I've got the following code on quit to make sure the NSOperationQueue is empty before quitting:
if ([NSThread isMainThread]) {
while ([[operationQueue operations] count] > 0) {
[[NSRun...
So I'm trying to do all my REST calls that download data on the background thread so that the UI stays responsive.
I have a viewcontroller that contains a NSOperationQueue. I create an instance of my importer class that is a subclass of NSOperation. Inside the main() method of my importer, I am setting up a ASIHTTPDataRequest. I create ...
Hello everyone,
My project is a Thumbnail image gallery. I implemented it using a UITableView which has custom cells. In each cell there's 4 UIButtons which has the images. And the images are downloaded from the internet using their URLs.
The way I'm assigning the images to the buttons is using Jasarien's method described in this post....
Hi I have an NSArray containing many 'multimedia action' as I like to call them, objects that encapsulate some multimedia content like movies and photos. I'd like to 'play' them in sequence waiting each one finished before calling the other.
What is the best way to manage the duration of each operation before calling the next one? (for ...
Hi
I am writing a code that reads data from a http connection and stores in a byte array.
I have written my own NSOperation class. Reference of the code is
Concurrent Operations Demystified
My HttpWorker class declaration is like
@interface HttpWorker : NSOperation{
NSString *param;
double requestCode;
BOOL isLive;
l...
When working with a custom NSOperation subclass I noticed that the automatic key-value observing is disabled by the [NSOperation automaticallyNotifiesObserversForKey] class method (which returns NO at least for some key paths). Because of that the code inside of NSOperation subclasses is littered by manual calls to willChangeValueForKey:...
The Problem
I have an NSOperationQueue called logEntryGeneratorQueue
I want to wait until all operations on the queue have completed
If I use:
[logEntryGeneratorQueue waitUntilAllOperationsAreFinished];
it works fine if the thread adding to the queue is in the background itself.
However, if I'm running this code via a unit test,...
I've created an NSOperation in the queue like so:
ImageLoadingOperation *operation = [[ImageLoadingOperation alloc] initWithImageURL:url target:self action:@selector(didFinishLoadingImageWithResult:)];
[operationQueue addOperation:operation];
[operation release];
And this works fine but if the view gets popped before the operation fin...
I have NSOperationQueue with some NSOperations in it (NSInvocationOperations, in particular). This operations do some calculations and change states of UI elements accordingly (of course, via performSelectorOnMainThread:...), often with use of animations.
My UI has UINavigationViewController and some buttons for navigation to another vi...
I have an app that uses NSOperations to manage service calls to a web API (the calls are based on CURLOperation in Jon Wight's touchcode).
There is a certain call that downloads map locations when the center of a map view changes significantly; since these can stack up so quickly, if you move the map around, I try to aggressively cancel...
Greetings,
I have a strange issue when calling .navigationController popViewControllerAnimated:YES from an NSOperation where the screen does not properly update and leaves the popped view visible but apparently deallocated.
Details: I have a list view that accesses a local sqlite database. When tapping on a record, it displays that r...
I have a gallery app that i am writing and need to download up to 30 images to the phone for offline viewing. Downloading isn't a problem but I am wondering what the recommend number of queues that I should create for downloading the images.
...
I have some NSOperations subclasses that handle CoreData imports. I believe i've ticked most of the non-main thread issues
I create my own autorelease pool in the
main method
I create a NSManagedObjectContext for each
operation
These operations are loaded into a NSOperationQueue, with the maximum number of concurrent operations set 1...
Background
This is the same background as my previous question, except the Outline view doesn't have a fetch predicate.
I've got an NSOutlineView that shows TrainingGroup entities.
The NSOutlineView is bound to an NSTreeController
In the NSTreeController, I've got "Preserve Selection" ticked and "Select inserted objects" unticked.
Ea...
I have an app that needs to send date (using POST) to a server. This function has to be on one of the NavigationController sub-controllers and user should be able to navigate away from this controller and/of close the app (only iPhone4/iOS4 will be supported).
Should I use threads/NSOperations or/and send data using existing asynchronous...
Hi All,
I am struggling to find a way to synchronize operation on IPhone app.
I have three main NSOperation.
NSInvocationOperation *showSpinner = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(spinnerOn:) object:YES];
NSInvocationOperation *reloadDatasource = [[NSInvocationOperation alloc] initWithTarget:...
Background
I've got the following tree of objects:
Name Project
Users nil
John nil
Documents nil
Acme Project Acme Project <--- User selects a project
Proposal.doc Acme Project
...