I am getting data from Dictionary. It works well and stores data in NSMutableArray I want that before adding object into need to make sure that Array does not contain same object with Same Name and Type. Please see below.
Before inserting object we should check that it does not contain object with Type and Name if contains no need to insert.
NSArray *resultDic = [result1 objectForKey:@"results"];
for (int i = 0; i<[resultDic count]; i++) {
id item = [resultDic objectAtIndex:i];
NSDictionary *jsonDict = (NSDictionary *) item;
GetData *theObject =[[GetData alloc] init];
NSString*error = [jsonDict valueForKey:@"error"];
if(![error isEqualToString:@"No Record Found."])
{
[theObject setVaccineID:[jsonDict valueForKey:@"ID"]];
[theObject setVaccineName:[jsonDict valueForKey:@"Name"]];
[theObject setVaccinationType:[jsonDict valueForKey:@"Type"]];
[theObject setVaccineType:[jsonDict valueForKey:@"VType"]];
[theObject setFarmName:[jsonDict valueForKey:@"FName"]];
[theObject setDay:[jsonDict valueForKey:@"Day"]];
[theObject setAddedDateTime:[jsonDict valueForKey:@"DateTime"]];
[appDelegate.dataArray addObject:theObject];
}
}