I'm falling at the first hurdle in Project Builder

markpatterson

Registered
Hi,

I thought I'd use the xmas / new year break to try out Project Builder, following the Currency Calculator example. It was all easy enough to follow, but I can't actually get the app to run. It compiles OK, but throws error messages when I run it. Can anyone help?

The error messages I'm getting are as below

TIA, Mark

2003-01-19 18:47:45.470 Currency Tutorial[1165] An uncaught exception was raised
2003-01-19 18:47:45.474 Currency Tutorial[1165] *** class error for 'ASKNibObjectInfo': class not loaded
2003-01-19 18:47:45.474 Currency Tutorial[1165] *** Uncaught exception: <NSArchiverArchiveInconsistency> *** class error for 'ASKNibObjectInfo': class not loaded

Currency Tutorial has exited with status 255.
 
I'd start by checking that you have put in the appropriate include/import statements, these are usually at the cery start of your code.
 
I have just gone through the whole of the tutorial (pdf) and looked at each include and import. I don't seem to have left anything out.
Could my problem have anything to do with versions? I'm using OS X 10.1.5, and Project Builder version 2.0, April 2002 Developer Tools Beta.
 
Perhaps you could post your code here? Sometimes it's hard to know what's going wrong without being able to see the code.
 
Well, you asked for it. Don't say I didn't warn you. Here it is:

ConverterController.h:
/* ConverterController */

#import <Cocoa/Cocoa.h>

@interface ConverterController : NSObject
{
IBOutlet id converter;
IBOutlet id dollarField;
IBOutlet id rateField;
IBOutlet id totalField;
}
- (IBAction)convert:(id)sender;
@end


ConvertController.m:
#import "ConverterController.h"
#import "Converter.h"

@implementation ConverterController

- (IBAction)convert:(id)sender
{
float rate, amt, total;

rate = [rateField floatValue];
amt = [dollarField floatValue];
total = [converter convertAmt:amt atRate:rate];

[totalField setFloatValue:total];
[rateField selectText:self];
}

- (void)awakeFromNib
{
[[ rateField window] makeKeyAndOrderFront: self];
[rateField selectText:self];
}

@end



Converter.h:
/* Converter */

#import <Cocoa/Cocoa.h>

@interface Converter : NSObject
{
}
- (float)convertAmt:(float)amt atRate:(float)rate;
@end



Converter.m
#import "Converter.h"

@implementation Converter
- (float)convertAmt:(float)amt atRate:(float)rate
{
return amt * rate;
}
@end
 
/ ConvertController.m:
/ #import "ConverterController.h"
/ #import "Converter.h"

Hmmm, I'm not sure if this matters but the name of your header file (.h) and implementation file (.m) are different. ConverterController and ConvertController.
 
Haven't looked at the code, but right off the top the first thing I see missing in your interface files is that after your #import you have nothing afterwards. Being that the CurrencyConverter is a Cocoa app, you should be importing the Cocoa/Cocoa.h interface file.
 
I agree with the two responses above.

Converter.h should import:
#import *Cocoa/Cocoa.h*
#import *Foundation/Foundation.h*

Converter.m should import:
#import "Converter.h"

ConverterController.h should import:
#import *Cocoa/Cocoa.h*
#import "Converter.h"

ConverterController.m should import:
#import "ConverterController.h"

P.S. the imported frameworks inside asterisks should instead be inside angle brackets, couldn't type the angle brackets because the forum thinks it is HTML code or something.
 
Originally posted by bjurusik
/ ConvertController.m:
/ #import "ConverterController.h"
/ #import "Converter.h"

Hmmm, I'm not sure if this matters but the name of your header file (.h) and implementation file (.m) are different. ConverterController and ConvertController.

Sorry, I did a typo! I shouid have types ConverterController.m
 
Originally posted by Oscar Castillo
Haven't looked at the code, but right off the top the first thing I see missing in your interface files is that after your #import you have nothing afterwards. Being that the CurrencyConverter is a Cocoa app, you should be importing the Cocoa/Cocoa.h interface file.

You're right, I don't know how that came across. It has
/* ConverterController */

#import <Cocoa/Cocoa.h>

in the actual code.
 
There is goes again!

the import statement must mean something in this html.
I'll try this, to show what is in the import statement:
import <Cocoa/Cocoa.h>
 
yup - that does the trick ... just use:
& l t ;
& g t ;
without the spaces in between to get the angle brackets (stands for less than and greater than)

C
 
So it turns out, unfortunately for community discussing objective C. In Mozilla Composer I find angle brackets are given like this
&lt;Cocoa/Cocoa.h&gt;

Anyway, G3-Joel, I tried adding the extra imports as you suggested, but still got that error. Thanks for the help. Any other ideas? I'd like to get this working.
 
Back
Top