我做了一個自定義的可可框架只是爲了試驗並找到最好的方法來製作一個,但遇到了使用它的問題。框架項目的構建和編譯很好,但是當我在xcode項目中使用它時,出現錯誤'LogTest' undeclared
。該框架的名稱是LogTest自定義可可框架和使用它的問題
繼承人使用該框架的代碼我的應用程序:
TestAppDelegate.h:
#import <Cocoa/Cocoa.h>
#import <LogTest/LogTest.h>
@interface TestAppDelegate : NSObject <NSApplicationDelegate> {
NSWindow *window;
}
@property (assign) IBOutlet NSWindow *window;
@end
TestAppDelegate.m:
#import "TestAppDelegate.h"
@implementation TestAppDelegate
@synthesize window;
- (void)awakeFromNib {
[LogTest logStart:@"testing 123":@"testing 1234"]; //This is the line where the error occurs
}
@end
框架代碼........
LogTest.h:
#import <Cocoa/Cocoa.h>
#import "Method.h"
@protocol LogTest //Not sure if this is needed I just wanted a blank header
@end
Method.h:
#import <Cocoa/Cocoa.h>
@interface Method : NSObject {
}
+ (void)logStart:(NSString *)test:(NSString *)test2;
@end
Method.m:
#import "Method.h"
@implementation Method
+ (void)logStart:(NSString *)test:(NSString *)test2 {
NSLog(test);
NSLog(test2);
}
@end
如果有誰知道爲什麼我收到此錯誤請回復。
感謝您的任何幫助
您能否包含Logtest.h的內容? – EightyEight 2010-03-20 00:12:03
當然我會在一分鐘內發佈它 – nosedive25 2010-03-20 00:22:18
這些錯別字在你的帖子中,你說AppDelegate.h和AppDelegate.m。頭文件被命名爲TestAppDelegate.h吧? – 2010-03-20 00:29:32