NSArray- help!
NSArray- help!
- Subject: NSArray- help!
- From: Dave Sopchak <email@hidden>
- Date: Sat, 2 Nov 2002 08:37:07 -0800
Hi all,
I'm having trouble accessing an NSArray I've made...the program keeps
crashing with an "EXC_BAD_ACCESS" error using the debugger, or "the app
has exited due to signal 10 (SIGBUS)"
The offending line, at the bottom of the code snippets:
GuideStar* currentGuide = [guideStarArray objectAtIndex: 0];
in the "guide" method.
My intention is to make an array of 3 guide objects, each object will
get modified in time. If I read the docs correctly, I can use an
NSArray for an "immutable" array of objects- by this I take it that the
array of objects, not the objects themselves, must remain untouched
(can't add or remove array objects).
of course now all I'm trying to do is get the address of one of the
objects and it keeps crashing...what am I missing?
thanks for any and all...Dave
relevant code snippets:
@interface Telescope : NSObject
{
NSArray* guideStarArray;
int guideStarNum;
double scopeMat[3][3];
double ngScpMat[3][3];
double localMat[3][3];
double celesMat[3][3];
double s2cMat[3][3];
double c2sMat[3][3];
double s2LMat[3][3];
}
-(id)init;
-(void)guide:(GuideStar*)object;
////////////////////
-(id) init
{
GuideStar* guideStar1 = [[GuideStar alloc] init];
GuideStar* guideStar2 = [[GuideStar alloc] init];
GuideStar* guideStar3 = [[GuideStar alloc] init];
GuideStar* test;
if (self = [super init])
{
guideStarArray = [NSArray arrayWithObjects: guideStar1,
guideStar2, guideStar3, nil];
[guideStar1 release];
[guideStar2 release];
[guideStar3 release];
}
}
-(void)guide:(GuideStar*)object
{
GuideStar* currentGuide = [guideStarArray objectAtIndex: 0];
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.