I have a dictionary declared, like this,
NSString *responseString = [request responseString];
responseDict = [responseString JSONValue];
for (id key in responseDict){
NSLog(@"%@ : %@", key, [responseDict objectForKey:key]);
}
Result :
013-01-22 00:14:02.323 PromoTest[2352:c07] A : 0
2013-01-22 00:14:02.325 PromoTest[2352:c07] B : 1
2013-01-22 00:14:02.325 PromoTest[2352:c07] C : 0
now, I want to compare the value and do some operation on it. I presumed the value for a key is of type NSString and compared it to my constant NSString, like this,
NSString *myString1 = @"0";
NSString *myString2 = [responseDict objectForKey:@"A"];
NSLog(@"%d", (myString1 == myString2)); //1
NSLog(@"%d", [myString1 isEqualToString:myString2]); //1
Result:
2013-01-22 00:19:12.966 PromoTest[2423:c07] 0
2013-01-22 00:19:12.966 PromoTest[2423:c07] 0
Where am i going wrong?? Is my comparison wrong? How do I go about correctly comparing the content??
The data is being received as response data from a web service. I am just converting the data into a dictionary for easily using it. The web service returns a JSON object,
{"A":0,"B":1,"C":0}