Error, but why?
Error, but why?
- Subject: Error, but why?
- From: email@hidden
- Date: Fri, 2 Nov 2001 11:23:07 -0500
So, I'm following along with this example for a Foundation Tool from a
book due in December. Here is the code for main.m, which builds without
error:
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[])
{
NSMutableArray *array;
int i;
NSNumber *number;
NSAutoreleasePool *pool = [ [NSAutoreleasePool alloc] init];
array = [ [NSMutableArray alloc] init];
for ( i = 0; i < 10; i++ )
{
number = [ [NSNumber alloc] init];
[array addObject: number];
}
NSLog(@"array = %@", array);
[array release];
[pool release];
return 0;
}
//end code
However, when I build and run (hammer & monitor icon) I get an "Error from
Executable Runner" message:
2001-11-02 11:07:18.489 lottery[563] *** Uncaught exception:
<NSInvalidArgumentException> *** -[NSCFArray addObject:]: attempt to
insert nil
lottery has exited with status 255.
//end error message
I'm supposed to get something like:
2001-11-02 11:07:18.489 lottery[563] array = (0, 1, 2, . . .9)
lottery has exited with status 0.
So, can anyone give me a clue or explanation as to what's going on? This
code was originally written some months ago with OS X 10.0.x and related
tools. I'm now on 10.1--OS & Tools. Did I miss something in the release
notes? Thank, as always.
Brian E. Howard
Cocoa Cult Central
tooling along, slowly