Re: Error, but why?
Re: Error, but why?
- Subject: Re: Error, but why?
- From: John Hörnkvist <email@hidden>
- Date: Fri, 2 Nov 2001 18:00:43 +0100
On Friday, November 2, 2001, at 05:23 PM, email@hidden wrote:
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.
The code's wrong; you need to decide what number you want. It's OK for
init to return nil. A number without a value makes no sense, so init
just returns nil.
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 numberWithInt:i]; // Fix; get a n
[array addObject: number];
}
NSLog(@"array = %@", array);
[array release];
[pool release];
return 0;
}
Regards.
John Hornkvist
--
ToastedMarshmallow, the perfect Cocoa companion
http://www.toastedmarshmallow.com