Reputation: 336
I am getting new warning on my old OSX app. I am using OSX 10.10 and I am not quite sure where the problem is. Can someone help?
The actual warning is Property type 'id is incompatible with type id inherited from NSTextField
#import <Cocoa/Cocoa.h>
#import "HyperlinkTextFieldDelegate.h"
@interface HyperlinkTextField : NSTextField <NSTextFieldDelegate>
@property (assign) id <HyperlinkTextFieldDelegate> delegate; <--- warning showing up here
@end
The main implementation is
@interface HyperlinkTextField ()
@property (nonatomic, readonly) NSArray *hyperlinkInfos;
@property (nonatomic, readonly) NSTextView *textView;
- (void)_resetHyperlinkCursorRects;
@end
#define kHyperlinkInfoCharacterRangeKey @"range"
#define kHyperlinkInfoURLKey @"url"
#define kHyperlinkInfoRectKey @"rect"
@implementation HyperlinkTextField
@synthesize delegate;
And the delegate file is
#import <Foundation/Foundation.h>
@protocol HyperlinkTextFieldDelegate <NSObject>
- (void) barLinkClicked: (id) sender;
@end
Upvotes: 0
Views: 88
Reputation: 535989
NSTextField already has a delegate
property, and it is typed as id<NSTextFieldDelegate>
. Thus, your HyperinkTextField, which is a subclass of NSTextField, inherits this property, just as the error message clearly tells you. You cannot override this inherited property and type it as id<HyperlinkTextFieldDelegate>
where that is a different type.
Upvotes: 1