Having a problem with simple bool

Posted by Code on Stack Overflow See other posts from Stack Overflow or by Code
Published on 2011-01-04T19:39:32Z Indexed on 2011/01/04 19:53 UTC
Read the original article Hit count: 132

Filed under:
|

Hi guys,

I've some really simple code that checks if my bool is == YES but it does not ever enter.

NSLog(@"boool %d",self.arrayAlreadyPopulated );

if (self.arrayAlreadyPopulated == YES) 
{
Match *aMatch = [appDelegate.matchScoresArray objectAtIndex:(numMatchCounter)];
aMatch.teamName1 = TeamNameHolder;
}
else 
{

Match *aMatch = [[Match alloc] init];
aMatch.teamName1 = TeamNameHolder;
    [appDelegate.matchScoresArray addObject:aMatch];
[aMatch release];
}

The debug at the top says that the value of self.arrayAlreadyPopulated is 1 on the 2nd pass as it should be.

But it never enters the first first part but jumps down to the 'else'

I cant see for the life of me what the problem is. -.-

Anybody able to clue me in?

Thanks -Code

EDIT declaration code

int theCounterCauseABoolWontWork;
@property (nonatomic) int theCounterCauseABoolWontWork;

@synthesize theCounterCauseABoolWontWork;

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c