我得到了 XCode 标签ARC Issue
,我很难解析。我有这堂课:
typedef void (^sig_cb_t)(NSString *parm);
@protocol Signaleer
// <snip>
-(void) connect:(NSString *) verb
parm:(NSString*) param
callback:(sig_cb_t)callback;
@end
// In another header:
@interface Switchboard : NSObject <Signaleer> {
@private
NSMutableDictionary *bus;
}
// In init: method:
bus = [[NSMutableDictionary alloc] init];
// actual implementation:
-(void) connect: (NSString *)verb
parm:(NSString*)parm
callback:(sig_cb_t)callback {
NSMutableArray *callbacks = [self.bus objectForKey:verb];
NSArray *signal = [NSArray arrayWithObjects:callback, parm, nil];
if (callbacks == nil) {
NSArray *initial = [NSArray arrayWithObjects:signal, verb, nil];
[bus setObject: initial, forKey:verb];
} else {
[callbacks addObject:signal];
}
}
该行[bus setObject: initial, verb]
导致错误No visible @interface for 'NSMutableDictionary' declares the selector 'setObject:'
。谁能解释一下?