for(NSDictionary *feed in Feeds)
{
NSString *feedName=[feed objectForKey:@"name"];
if(listofBusiness==nil)
{
listofBusiness=[[NSMutableArray alloc]init];
}
if([listofBusiness indexOfObject:feedName] !=NSNotFound)
{
[listofBusiness addObject:feedName];
[feedName release];
feedName=nil;
}
}
in this code when compiler comes on this statement
if([listofBusiness indexOfObject:feedName] !=NSNotFound)
then not go into codition and go to increment in for loop so that any element is not added in array.what is error in this code?
The logic appears to be inverted – you probably want it to add the elemement when
But at the moment you have the opposite – you only try to add the object when it is ‘not not found’ – i.e. when it is already present in the list.