nsthread

NSOperations or NSThread for bursts of smaller tasks that continuously cancel each other?

Hi I would like to see if I can make a "search as you type" implementation, against a web service, that is optimized enough for it to run on an iPhone. The idea is that the user starts typing a word; "Foo", after each new letter I wait XXX ms. to see if they type another letter, if they don't, I call the web service using the word as a...

What is wrong with my @synchronized block?

I have 2 threads in my application, a game update thread and render/IO/main thread. My update thread updates the game state, and the render thread renders the scene based on the updated values of the game state models and a few other variables stored inside an object (gameEngine). The render thread gets executed while the game thread is...

very strange thread error message

I an trying to put a method in a separate thread in the background. It nearly works except that occasionally I get a lot of error messages with the message METHODCLOSURE: OH NO SEPERATE THREAD with the bad spelling and all. Does anyone know what this means? The thread runs, interestingly More specifically: I invoke a background pr...

XML parsing on new thread

Hi all, In my application, I want to fetch new xml data after user scrolls through tableview and pulls the first cell down. As the data is loaded in tableview in chronological order, the updated data will be shown before the first cell. I want to run this process on new thread, so what is the best option : Subclass NSThread and use i...

NSThread terminating too early

I have an app that uploads to Google Spreadsheets via the GData ObjC client for Mac/iPhone. It works fine as is. I'm trying to get the upload portion on its own thread and I'm attempting to call the upload method on a new thread. Look: -(void)establishNewThreadToUpload { [NSThread detachNewThreadSelector:@selector(uploadToGoogle)...

xcode loading the images in background process, it leads to crash the application when i scroll the tableview fast?

Hi, I have developed an application which has retrieved the information from remote location...so i put those in UITableView's Section.In response, i will be getting images also..for this i put the background process(only for images..because the app will take more time to retrieve images than text based information..).It is working fine....

IconDownloader, problem with lazy downloading

My problem is simple to be described but it seems to be hard to solve. The problem is loading icons, with a custom class like IconDownloader.m provided by an official example from Apple, avoiding crashes if I release the view. I've added the IconDownloader class to my app, but it's clear that this approach is good only if the tableview ...

Can NSTask safely be used outside the main thread?

Yesterday I read somewhere that NSTask isn't thread safe and that bothers me a lot, because I'm running a NSTask within a NSThread and is so far not experiencing any threading issues with it. My code is organized like this A: main thread -> B: worker thread -> C: worker task C: The worker task is a commandline program. B: The worker t...

NSThread vs. NSOperationQueue vs. ??? on the iPhone

Currently I'm using NSThread to cache images in another thread. [NSThread detachNewThreadSelector:@selector(cacheImage:) toTarget:self withObject:image]; Alternatively: [self performSelectorInBackground:@selector(cacheImage:) withObject:image]; Alternatively, I can use an NSOperationQueue NSInvocationOperation *invOperation = [[N...

How to Loop NSThread?

Hello everyone, I am curious to know if you can loop an NSThread for the iphone sdk. I have learned that instead of using NSTimers which do run off of the main UI, I can use NSThreads to run actions in the background. Most of my NSTimers have the "repeats:" to YES, thus I need to know if NSThreads can be looped. Thanks Kevin ...

How to pass NSTimeInterval object to detachNewThreadSelector withObject parameter?

I'm still new to Objective C syntax, so I might be overcomplicating this, but I can't seem to figure out how to pass an NSTimeInterval to a thread. I want to initiate a thread that sleeps for x seconds parameter sent from main thread as follows: [NSThread detachNewThreadSelector:@selector(StartServerSynchThread) toTarget:self withObje...

How to stop a NSThread in iphone?

I have called a method using NSthread. I want to stop the thread on a click event of button. How can i achieve that ?Please help me out.Thanks. [NSThread detachNewThreadSelector:@selector(playVideo) toTarget:self withObject:nil]; ...

Threaded NSTimer

Hi all, I am aware of the many questions regarding this topic, as I myself have asked one previously however, my issue now seems to be more related to the threading part. I have the following 2 methods. -(void) restartTimer { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init]; self.timer = [NSTimer scheduledTimerWithTimeInterval...

How to stop a NSThread sub-thread in iphone

I created a sub-thread using NSThread in main thread NSThread *newThread = [[NSThread alloc] initWithTarget:self selector:@selector(MyThread:) object:timer]; 5 sec later,i used [newThread cancel] in main thread to stop the sub-thread,but it didnt work, Method MyThread: in newThread still working so,whats the correct answer to stop ne...

NSThread to slow down Array being printed to console in Objective-C? so confused...

so I have an array with objects @"One", "Two", "Three", "Mouse" and I want to have each word of the array NSLog'ed to the console in half second increments. I also would like to be able to switch to 1 second increments instead. Can anyone please help me write this code. I'm new, but I need to understand this project. I was tipped that I...

I don't know why my view is freezing

Hi there! I have a big problem since a few days that I can't solve. First I have a login view controller with this code : @implementation MMConnectionViewController @synthesize login, password, activityIndicator, mainVC; - (BOOL)textFieldShouldReturn:(UITextField *)aTextField { [aTextField resignFirstResponder]; [self performSel...

NSThread - help with loading an image from a URL

I'm trying to use threading to load an image from a url. I have no background code and I'm having trouble getting the NSThread thing to work. What I've got is a UIimageView called photo1 and I've got an image that loads in from the net. (say http://www.google.com/logos/classicplus.png) but when navigating to the screen, the app pauses to...

OpenGLES fails to generate Framebuffers in iPhone thread

Hello, I've got a lovely OpenGLES code slice that renders up images for me. When I want to, I can call a function on it: -(UIImage *)renderToImage; That does a lot of rendering work and returns me an image. This includes the generation of FBOs, textures, etc. Lately, I've found myself needing to enhance this. The image generation ta...

How can I pass two value to a NSThread object from the main thread OR have the same value in both threads?

I have a function which executes as a different thread, thread named imageThread. But when the device rotates, the control automatically returns to the main thread and after their execution its given back to the imageThread. That's how i wanted it to function. But the problem is I am using some global variables, whose value changes in th...

Problem with Thread and NSTimer

Hi I have a problem in my code. I want to launch the thread but when it is launched they can't start a NSTimer istruction. Can you help me? -(void)detectionMove:(NSTimer*)timer{ int indexArray = [[[timer userInfo] objectForKey:@"arrayIndex"] intValue]; // do something } -(void)callDectectionMove:(NSNumber*)arrayIndex{ ...