0

なぜこのエラーですか?すべての括弧を閉じたと思います。これはコードです:

  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++;
     }
4

2 に答える 2

2

あなたは変わるべきです

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

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

ブール値のテストを行うときは[string rangeOfString:age].location != NSNotFound、[ と ] に含めないでください。

于 2012-06-28T07:28:41.250 に答える
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++;
}
于 2012-06-28T07:36:41.107 に答える