Animating Graphics in Cocoa, Part 1
Subject:   Array of NSBezierPath objects
Date:   2004-01-03 18:59:08
From:   anonymous2
Hi, I'm wondering if it's possible to create an array of NSBezierPath objects. I tried the following:

NSArray *myArray; //interface declaration
NSBezierPath *path; //interface decl.

//in implementation
path = [[NSBezierPath bezierPath] retain];
myArray = [NSArray arrayWithObjects:path count:10];

When I run the program, I get the following output in the console:

2004-01-03 20:38:30.510 Galaxies[5578] An uncaught exception was raised
2004-01-03 20:38:30.510 Galaxies[5578] *** -[NSPlaceholderArray initWithObjects:count:]: attempt to insert nil
2004-01-03 20:38:30.510 Galaxies[5578] *** Uncaught exception: <NSInvalidArgumentException> *** -[NSPlaceholderArray initWithObjects:count:]: attempt to insert nil

Galaxies has exited due to signal 5 (SIGTRAP).

I'm trying to draw galaxies, with each star being an NSBezierPath object, so that's why I'm trying to do it with arrays. I wouldn't want to have to make each star individually, since there are hundreds of them.