Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > Mac OS X Development Forums > Objective-C, Python, Ruby Development

Reply
 
LinkBack Thread Tools Display Modes
Old 10-17-2009, 11:23 PM   #1 (permalink)
Registered Member
 
Join Date: Jan 2009
Location: Orange County, CA
Posts: 20
dannys42 is on a distinguished road
Default delegate protocol problem

I'm trying to implement a delegate following a protocol. I found that I had specify my protocol as inheriting NSObject to allow it to support the performSelector call.

However, now I'm trying to do a "performSelector:withObject:afterDelay:", and I'm continuing to get this warning. Looking at the header file, this is specified in a category NSObject(NSDelayedPerforming).

But how do I make my protocol conform to that?


Here's the warning message I'm getting:
Quote:
warning: '-performSelector:withObject:afterDelay:' not found in protocol(s)
Here's an example of what I'm doing with the Protocol:
Code:
@protocol MyProtocol <NSObject>
-(void)doSomething(id referingObject);
@end

@interface MyClass : NSObject {
  id <MyProtocol> delegate;
}
@property (nonatomic, assign) id <MyProtocol>delegate;
@end

@implementation MyClass
-(void)callMyDelegate {
      if( delegate && [delegate respondsToSelector:@selector(doSomething:)] ) {
        [NSObject cancelPreviousPerformRequestsWithTarget:delegate 
                                                 selector:@selector(doSomething:)
                                                   object:self];
        [delegate performSelector:@selector(doSomething:) 
                       withObject:self 
                       afterDelay:0.1];
   }
}
@end
Neither of these seem to work:
  • @protocol MyProtocol <NSObject, NSDelayedPerforming>
  • @protocol MyProtocol <NSObject, NSObject(NSDelayedPerforming)>
>


Any suggestions?

Thanks
dannys42 is offline   Reply With Quote
Reply

Bookmarks

Tags
delegate, protocol

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 470
13 members and 457 guests
Domele, Duncan C, Feldspar, MacBook MH, Objective Zero, patapple, peterwilli, pipposanta, PixelInteractive, Punkjumper, SLIC, taylor202, Today's Posts
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,694
Threads: 94,137
Posts: 402,950
Top Poster: BrianSlick (7,990)
Welcome to our newest member, peterwilli
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:04 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0