我的项目是用ApplescriptObjC和Objective-C编写的。 我有一个NSTabViewDelegate,必须用ObjC编写:
#import <Cocoa/Cocoa.h>
#import "MSItems.h"
@interface MSTabView : NSTabView<NSTabViewDelegate>
- (void)tabView:(NSTabView *)tabView willSelectTabViewItem:(NSTabViewItem *)tabViewItem;
@end
@implementation MSTabView
- (void)tabView:(NSTabView *)tabView willSelectTabViewItem:(NSTabViewItem *)tabViewItem {
if ([[tabViewItem identifier] intValue] == 1) {
[MSItems myMethod];
}
}
@end
MSItems类是用ApplescriptObjC编写的,但我创建了一个头文件,它只包含我需要被其他类调用的方法。
#import <Cocoa/Cocoa.h>
@class MSItems;
@interface MSItems : NSObject
+ (void) myMethod;
@end
在ASObjC课程中我有:
script MSItems
property parent : class "NSObject"
on myMethod()
--stuff
end myMethod
end script
但该应用程序无法编译,我收到错误:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_MSItems", referenced from:
objc-class-ref in MSTabView.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)