I'm having a hard time accessing an NSArray I made within the same object.
in the header file:
Code:
...
@class DictEntry;
@interface DictController : NSObject {
NSArray *entryList;
NSMutableArray *dictEntries;
}
@property (nonatomic, retain) NSArray *entryList;
@property (nonatomic, retain) NSMutableArray *dictEntries;
...
To create the array:
Code:
dictEntries = [[NSMutableArray alloc] initWithCapacity:71080];
// Make array of dictionary entries
for ( int n = 35; n <= 71115; n++ ) {
// Create the temporary dictionary entry
DictEntry *tempDict = [[DictEntry alloc] init];
[tempDict setEntry:[self.entryList objectAtIndex:n]];
[dictEntries addObject:tempDict];
[tempDict release];
}
NSLog( @"dictEntries debug after creation" );
[[dictEntries objectAtIndex: 65] debug];
To access an element of the array:
Code:
NSLog( @"dictEntries amount" );
NSLog( [NSString stringWithFormat:@"%d", [dictEntries count]] );
NSLog( @"dictEntries debug at access" );
[[dictEntries objectAtIndex: 65] debug];
The debug function just prints out the values of the object. It properly prints the number of entries in the array, but then it crashes when I try to run the debug function... even though it properly runs in the function which sets up this array! Does anyone see what I'm doing wrong here or can direct me to finding a solution? Thanks in advance!