I have a Iphone app with 2 threads. One is listening to the server, and the other is doing UIKit, OpenGl stuff.
I need to run a method that updates a view from the secondary thread thats listening to a server on the main thread that handles the views so I used
performSelectorOnMainThread:@selector"createGuessingView" withObject:nil waitUntilDone:YES
but for some reason, the method never gets executed. Putting a breakpoint or a printf at the beginning of the method shows that its never invoked. Im really stumped here. Ive used performselectoronmainthread
in the same program to update text fields and it worked flawlessly.
edit:
Figured it out :) The problem was that the object that I was using performSelectorOnMainThread was set by this thread before the object was initialized (even allocated) in the main thread. Therefore, the reference was pointing to null, and the selector was not getting recognized.
Thanks for the help