(My english is not good).
I have two NSArray.
EXAMPLE:
1st NSArray is storing
NSArray category= { ID:1,Name:Category1;ID:2, Name: Category2;ID:3, Name:Category3;}
2nd NSArray is storing
NSArray product= {cat_ID:1, Category-Name:Category1, product_ID:1, Name: Banana;
cat_ID:1, Category-Name:Category1, product_ID:2, Name: apple;
cat_ID:1, Category-Name:Category1, product_ID:3, Name: berry;
cat_ID:2, Category-Name:Category2, product_ID:4, Name: cantaloupe;
cat_ID:2, Category-Name:Category2, product_ID:5, Name: elderberry;
cat_ID:2, Category-Name:Category2, product_ID:6, Name: ginger;
cat_ID:2, Category-Name:Category2, product_ID:7, Name: watermelon;
cat_ID:3, Category-Name:Category3, product_ID:8, Name: xigua;
cat_ID:3, Category-Name:Category3, product_ID:9, Name: avocado;
cat_ID:3, Category-Name:Category3, product_ID:10, Name: basil;
cat_ID:3, Category-Name:Category3, product_ID:11, Name: alfalfa;
cat_ID:3, Category-Name:Category3, product_ID:12, Name: blackcurrant;}
All i want is if category name (i mean 1st NSArray category.name) is equals to 2nd NSArray’s category name (i mean product.Category-Name) then print all product name.
Example: category.name== Category1; then result will be Product.Name = Banana, Apple, Berry;
How to do this?
From your json-like notation, we will assume that key value pairs in “{…}” are NSDictionary objects. And you have an array of said NSDictionary objects, “[{…},{…},…]”
To get the products for a given category: