我正在尝试通过类别向 CPArrayController 类添加一个方法。将反向添加到 CPString 的模板工作正常,但我无法向 CPArrayController 添加任何内容。编译时出现错误
SyntaxError: *找不到类“CPArrayController”的定义
这是我的代码:
@import <AppKit/CPArrayController.j>
@implementation CPArrayController (Inserting)
- (CPObject)insertAndReturn
{
if (![self canInsert]) return nil;
var newObject = [self automaticallyPreparesContent] ? [self newObject] : [self _defaultNewObject];
[self addObject:newObject];
return newObject;
}
@end
知道为什么吗?