Hi all,

I have a formal protocol for a notification callback I want to make. The 
protocol inherits the NSObject protocol.

The caller accepts only objects conforming to this protocol as its delegate. 
When it's time to invoke the callback, I'd like to do so on the main thread, 
since the caller can be running on another thread. But 
-performSelectorOnMainThread:withObject:waitUntilDone: is not part of the 
NSObject protocol, it's part of the methods of NSObject, so my code won't 
compile because id<MyProtocol> objects don't include this method.

How can I invoke a method of my protocol on the main thread?


@protocol MyProtocol<NSObject>

- (void)                foo:(Caller*) caller;

...


@interface Caller : NSObject

@property (assign) id<MyProtocol>       delegate;

...



[self.delegate performSelectorOnMainThread:@selector(foo) withObject:self 
waitUntilDone:NO];            // method not found




--Graham



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to