This is my code:
//elementsValues is type of NSDictionary. currentElementValue is type of NSString.
//resultArray is type of NSArray.
//elementName = [[NSString stringWithFormat:@"SignOnResult"];
[self.elementsValues setObject:self.currentElementValue forKey:elementName];
[self.resultArray addObject:self.elementsValues];
NSLog(@"%@",[resultArray valu开发者_C百科eForKey:@"SignOnResult"]);
The output i get is printed in between " ". So does NSDictionary give output always in " " ? I dont want the string in " ".
You are doing wrong for calling valueForKey:
with resultArray
instance it will return you the empty NSArray
,
NSLog(@"%@",[resultArray valueForKey:@"SignOnResult"]); // wrong statement
Try to change as
NSLog(@"%@",[[resultArray objectAtIndex:dictionaryIndex] valueForKey:@"SignOnResult"]);
Here dictionaryIndex
is the integer type and point the valid index and dictionary object in your resultArray
.
NSDictionary *dictionary = [self.resultArray objectAtIndex:0];
NSLog(@"%@",dictionary);
精彩评论