I have an array of objects that I need to filter. I know that I should b using NSPredicate but can't seem to find an answer to filtering by a string in an object, inside of another object.
Here is what a single object of the array looks like:
{
"data_center"
{
"id":1,
"site_id":17,
"name":"Building",
"shortname":"ORL-Building",
"created_at":"2011-10-28T06:32:39Z",
"updated_at":"2011-10-28T06:32:39Z",
"site":
{
"id":17,
"name":"Orlando",
"shortname":"ORL"
}
}
}
How can I filter the Array using Site.name in the nested object? The array itself is an NSArray which requires filteredArrayUsingPredicate:.
Also, The way that I am finding the data to filter the array by is by pulling it from a UIPickerView, So I have to retrieve the object that was used from a different pickerview, and filter a second array based on the string for site name.
I couldn't seem to find a good answer to this one, If anyone has any advice I would be much appreciative.