AhabLives
AhabLives

Reputation: 1468

why is this for loop not getting called?

Hello and thanks for the help

Why is this for loop not getting called. (contents is an nsmutableArray)

 NSString *setBiz = [[NSString alloc]init];
setBiz = @"MomAndPop";
 NSLog(@"??????????listby???????????%@\n",setBiz);


for (NSDictionary *key in self.contents) {
    NSLog(@"hi inside loopppp");  //I never see this ????????

     NSString *c = [key objectForKey:@"BizName"];
    NSString *string = [NSString stringWithFormat:@"%@", key];  //random test 


    if ([c isEqualToString:setBiz]) {
        NSLog(@"gotch you");
    }

}

Upvotes: 0

Views: 98

Answers (1)

Daniel Amitay
Daniel Amitay

Reputation: 6667

The most likely answer is that self.contents has no elements inside of it.

Place this before your loop to output the number of elements in the loop:

NSLog(@"self.contents.count: %lu", self.contents.count);

Upvotes: 3

Related Questions