1

I'm downloading and parsing a XML document. During this, I want to update my UIProgressView. I know I have to do this in the main thread, and not in the background thread where the document gets parsed.

But my problem is, when I try this:

[self performSelectorOnMainThread:@selector(setProgressStr) withObject:[NSString stringWithFormat:@"%f", updateTo] waitUntilDone:NO];

I send it via a NSString, because a float won't work. But now I get the next error:

-[TDFetch setProgressStr]: unrecognized selector sent to instance 0x6b9a700

What am I doing wrong?

dododedodonl
  • 4,585
  • 6
  • 30
  • 43
  • possible duplicate of [iphone notification results in "unrecognized selector sent to instance..."](http://stackoverflow.com/questions/4523357/iphone-notification-results-in-unrecognized-selector-sent-to-instance) also [iPhone Unrecognized Selector](http://stackoverflow.com/questions/7284116/iphone-unrecognized-selector) – jscs Nov 03 '11 at 19:07

2 Answers2

4

If the method you're trying to use takes an argument, that means that it has a colon in the name -- the colon is actually a part of the name. You need to include that when you get the selector:

@selector(setProgressStr:)
jscs
  • 63,694
  • 13
  • 151
  • 195
2

Looks like you forgot about ':' after name of selector. Try

[self performSelectorOnMainThread:@selector(setProgressStr:) withObject:[NSString stringWithFormat:@"%f", updateTo] waitUntilDone:NO];
Vitaly S.
  • 2,389
  • 26
  • 40