Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 08-23-2008, 06:34 AM   #1 (permalink)
chuck
Registered Member
 
chuck's Avatar
 
Join Date: Aug 2008
Location: Berlin, Germany
Posts: 87
chuck is on a distinguished road
Default can't access array object values

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!
chuck is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 175,391
Threads: 94,006
Posts: 402,465
Top Poster: BrianSlick (7,978)
Welcome to our newest member, Satnam
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 07:20 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.