Ortensia C.
Ortensia C.

Reputation: 4716

Message: Expected identifier

Why this error? I think that I has closed all brackets. This is the code:

  int i=0;

    while(i<count){

    if([[ageMatch rangeOfString:age].location != NSNotFound] && [[glassesSex rangeOfString:gender].location !=NSNotFound] && [[faceMatch rangeOfString:shape].location != NSNotFound]  ){ //Expected identifier
            [arrayNuovo insertObject:dictionary atIndex:i];

        }
        i++;
     }

Upvotes: 0

Views: 103

Answers (2)

Manish Agrawal
Manish Agrawal

Reputation: 11026

use this code

while(i < count){
if(([ageMatch rangeOfString:age].location != NSNotFound) && ([glassesSex rangeOfString:gender].location !=NSNotFound) && ([faceMatch rangeOfString:shape].location != NSNotFound)  ){ //Expected identifier
        [arrayNuovo insertObject:dictionary atIndex:i];
            }
    i++;
}

Upvotes: 0

Omar Abdelhafith
Omar Abdelhafith

Reputation: 21221

you should change

if([[ageMatch rangeOfString:age].location != NSNotFound] && [[glassesSex rangeOfString:gender].location !=NSNotFound] && [[faceMatch rangeOfString:shape].location != NSNotFound]  )

To

 if([ageMatch rangeOfString:age].location != NSNotFound && 
    [glassesSex rangeOfString:gender].location !=NSNotFound && 
    [faceMatch rangeOfString:shape].location != NSNotFound  )

When you do a boolean test, you do it like [string rangeOfString:age].location != NSNotFound and dont include them in [ and ]

Upvotes: 2

Related Questions