When I assign the value to the bank: banca.name = @"CheBanca!";
the following condition returns true.
if(banca.name==@"CheBanca!"){
header.bankNameLabel.textColor=[UIColor greenColor];
}
But when I assign the same value as: banca.name = [jsonBanca objectForKey:@"nome_banca"];
the condition return false although NSLog(@"Bank name: %@", [jsonBanca objectForKey:@"nome_banca"]);
outputs the value Bank name: CheBanca!
The following code shows how I get jsonBanca:
NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
[responseData release];
NSDictionary *results = [responseString JSONValue];
[responseString release];
NSArray *jsonBanche = [results objectForKey:@"banche"];
NSLog(@"%@",jsonBanche);
NSMutableArray *banks = [NSMutableArray arrayWithCapacity:jsonBanche.count];
for (int i=0; i<jsonBanche.count; ++i) {
NSDictionary *jsonBanca = [jsonBanche objectAtIndex:i];
}
This code NSLog(@"%@",jsonBanche);
returns the banks:
{
"nome_banca" = "CheBanca!";
"nome_prodotto" = "Conto Deposito";
rating = "A-1";
}, ...
The question is why this two strings @"CheBanca!" and the string recieved by JSON are not equal although they contain the same phrase. And how to make them equal to return true in the condition.