1

I made a custom cocoa framework just to experiment and find the best way to make one but ran in to a problem using it. The framework project builds and compiles just fine, but when I use it in an xcode project I get the error, 'LogTest' undeclared. The name of the framework is LogTest

Heres the code to my app that uses the framework:

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

Framework Code........

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

If anyone knows why I am getting this error please reply.

Thanks for any help

nosedive25
  • 2,477
  • 5
  • 30
  • 45

1 Answers1

0

From what I see of the header files you just posted. LogTest is not a class but an empty protocol. You should be calling logStart:: on Method not LogTest

IOW. change it to

- (void)awakeFromNib {
    [Method logStart:@"testing 123":@"testing 1234"];
}
Brandon Bodnar
  • 8,202
  • 2
  • 36
  • 42
  • When I do that I get a whole new set of errors in the build results. – nosedive25 Mar 20 '10 at 01:06
  • Those errors were likely being hidden by the previous error. The same matter before was that you were calling methods on a class that didn't exist. If you post your new errors we can see if we can help. – Brandon Bodnar Mar 20 '10 at 01:16
  • Ok well thanks the new error seems to be common in xcode: dyld: Library not loaded: (a long path here) Reason: image not found – nosedive25 Mar 20 '10 at 04:04
  • If I remember correctly that is something to due with the XCode not finding the dylib for the framework at runtime. A copy needs to be in the either /Library/Frameworks /System/Library/Frameworks or in the build folder of the product. – Brandon Bodnar Mar 20 '10 at 04:41
  • 1
    Or, you need to copy the framework into your app. http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPFrameworks/Tasks/CreatingFrameworks.html#//apple_ref/doc/uid/20002258-106880-BAJJBIEF – Peter Hosey Mar 20 '10 at 06:47