Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jjardim

macrumors newbie
Original poster
Mar 19, 2008
26
0
Trying to work with NSMutable array and having trouble -

here is part of the .h file

@class AllAnswers;

@interface StartDeck : UIViewController {

// Class Object to keep track of the past
AllAnswers *allanswers;
NSMutableArray *allanswersArray;

.....

In the .m file

allanswers = [[AllAnswers alloc] initWithFirst:temp1 initWithSecond:temp2 initWithThird:temp3 initWithFourth:temp4 initWithTop:randomTopValue initWithBottom:randomBottomValue];

[allanswersArray addObject:allanswers];
NSLog(@"temp1 - %i", temp1);
NSLog(@"Array - %i",[[self allanswersArray] temp1]);
NSLog(@"Array Count %i", allanswersArray.count);


The Log Shows
2010-01-09 11:50:22.464 FlashCards[10024:207] temp1 - 18
2010-01-09 11:50:22.465 FlashCards[10024:207] Array - 0
(gdb) continue
Current language: auto; currently objective-c
2010-01-09 11:50:25.625 FlashCards[10024:207] Array Count 0

I would think that the Log in Array - would print out the temp1 variable and the Array Count would return 1.
I set a break point and it seems nothing is in the array set.

Any Help would be appreciated.

Thanks,
Jardim
 
What do you think this is doing?

Code:
[[self allanswersArray] temp1]

Also NSArray count returns a NSUInteger. See the U? It means unsigned. Look at the NSLog format specifiers and think very carefully about whether %i is really what you want...
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.