FROM : James Bucanek
DATE : Thu Jul 20 16:43:57 2006
Eric Blanpied wrote on Thursday, July 20, 2006:
>I'm trying to use (void)performSelectorOnMainThread:(SEL)aSelector
>withObject:(id)arg waitUntilDone:(BOOL)wait, and I don't understand
>how to receive the argument.
>
> From the docs: "The method should not have a significant return
>value and should take a single argument of type id, or no arguments."
>
>I can make it work when my method has no arguments, but I want to
>pass a dictionary with some data. When I add (id)arg or (id*)arg, I
>get an exception with "selector not recognized".
>
>What's the proper way to do this, and how would I retrieve the dict
>once I got it? Would I cast the object as an NSDictionary?
You're probably running into the subtleties of Cocoa message naming. This one trips me up at least once a week:
@selector(myMethod) is the selector for - (void)myMethod;
@selector(myMethod:) is the selector for - (void)myMethod:(id)param;
Note the colon. It's important.
--
James Bucanek
DATE : Thu Jul 20 16:43:57 2006
Eric Blanpied wrote on Thursday, July 20, 2006:
>I'm trying to use (void)performSelectorOnMainThread:(SEL)aSelector
>withObject:(id)arg waitUntilDone:(BOOL)wait, and I don't understand
>how to receive the argument.
>
> From the docs: "The method should not have a significant return
>value and should take a single argument of type id, or no arguments."
>
>I can make it work when my method has no arguments, but I want to
>pass a dictionary with some data. When I add (id)arg or (id*)arg, I
>get an exception with "selector not recognized".
>
>What's the proper way to do this, and how would I retrieve the dict
>once I got it? Would I cast the object as an NSDictionary?
You're probably running into the subtleties of Cocoa message naming. This one trips me up at least once a week:
@selector(myMethod) is the selector for - (void)myMethod;
@selector(myMethod:) is the selector for - (void)myMethod:(id)param;
Note the colon. It's important.
--
James Bucanek
| Related mails | Author | Date |
|---|---|---|
| Eric Blanpied | Jul 20, 16:04 | |
| Buddy Kurz | Jul 20, 16:40 | |
| James Bucanek | Jul 20, 16:43 | |
| Sean McBride | Jul 20, 17:44 | |
| Eric Blanpied | Jul 20, 20:07 |






Cocoa mail archive

