Friday 15 May 2015

Get Specific Objects Inside An Array of Dictionaries in Objective-C -


I have an array of dictionaries and I want to get the value of that array in which the key is searching. / P>

For example, I have named this array as locationArray :

  ({id = 1, info = {name = "Person1 "Address =" Chicago ";}}}} ID = 2, info = {name =" person2 "; address =" Chicago "}}}} id = 3, info = {name =" person3 "; address = " New York "; };};);   

And I want to get an array of people with a street address in Chicago. The result will be as follows ( chicagoArray ):

  ({id = 1, info = {name = "Person1"; address = "Chicago";};}; Id = 2, info = {name = "person2"; address = "Chicago";};};);   

I have looped this but I do not know what has been made of my result: Error:

 for  (id result in locationArray) {if ([[Result Value ForKeyPath @ "info.address"] is EqualToString: @ "Chicago"]) // // What is the result inside of Array? // NSArray * resultArray = [[NSArray alloc] initWithObjects: @ ""]; }}   

How can I do this? Thanks!

  NSMutableArray * entries = [NSMutableArray array]; For (NSDictionary * dict in the array) {NSDictionary * innerDict = dict [@ "info"]; If ([Internal [["" address "] is avatostring: @" Chicago "]) [[Add entries: word];}}    

No comments:

Post a Comment