2010-03-19 36 views
1

我做了一個自定義的可可框架只是爲了試驗並找到最好的方法來製作一個,但遇到了使用它的問題。框架項目的構建和編譯很好,但是當我在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 

如果有誰知道爲什麼我收到此錯誤請回復。

感謝您的任何幫助

+1

您能否包含Logtest.h的內容? – EightyEight 2010-03-20 00:12:03

+0

當然我會在一分鐘內發佈它 – nosedive25 2010-03-20 00:22:18

+0

這些錯別字在你的帖子中,你說AppDelegate.h和AppDelegate.m。頭文件被命名爲TestAppDelegate.h吧? – 2010-03-20 00:29:32

回答

0

您不能在iPhone上使用已編譯的第三方框架。您可以包含源文件,然後與您的應用程序一起編譯它們。

此外,請參閱此link的其他討論。

+0

我沒有使用iPhone,但感謝您的回覆 – nosedive25 2010-03-20 00:21:59

0

從我剛剛發佈的頭文件中看到的內容。 LogTest不是一個類,而是一個空協議。您應該撥打logStart::Method而不是LogTest

IOW。將其更改爲

- (void)awakeFromNib { 
    [Method logStart:@"testing 123":@"testing 1234"]; 
} 
+0

好的,謝謝我會嘗試 – nosedive25 2010-03-20 00:42:59

+0

當我這樣做時,我在構建結果中得到一組全新的錯誤。 – nosedive25 2010-03-20 01:06:24

+0

這些錯誤很可能被以前的錯誤隱藏。之前的同一個問題是你在一個不存在的類上調用方法。 如果您發佈您的新錯誤,我們可以看看我們是否可以提供幫助。 – 2010-03-20 01:16:43