名前が以前にデータ配列に存在しない場合にのみ、データ配列に名前を追加したいと考えています。これらの名前を印刷しようとすると、繰り返しが発生します。これを解決する方法はありますか?
-(NSMutableArray *)autoComplete
{
NSMutableArray *dataArray = [[NSMutableArray alloc] init];
NSString *url = [NSString stringWithFormat:@"%@45.25,-95.25&limit=100&client_id=Von0J4Bu6INiez5bGby2R&client_secret=50sUjSbg7dba8cQgtpdfr5Ns7wyYTqtmKpUU3khQ",kWSURL];
NSDictionary * returnDict = (NSDictionary *) [self callWebService:url];
if([returnDict objectForKey:@"success"])
{
NSArray *responceArray = [returnDict objectForKey:@"response"];
for (NSDictionary *dict in responceArray) {
placeDC *place = [[placeDC alloc]init];
NSDictionary *placeDict = (NSDictionary *)[dict objectForKey:@"place" ];
NSDictionary *loctionDict =(NSDictionary *)[dict objectForKey:@"loc"];
NSString * name =[placeDict objectForKey:@"name"];
NSString * stateFull =[placeDict objectForKey:@"stateFull"];
NSString * countryFull =[placeDict objectForKey:@"countryFull"];
NSString *latitude =[loctionDict objectForKey:@"lat"];
NSString *longitude = [loctionDict objectForKey:@"long"];
place.placeNmae=name;
place.countryFullName=countryFull;
place.stateFullName=stateFull;
NSLog(@"%@ ",stateFull);
place.latitude=[latitude doubleValue];
place.longitude=[longitude doubleValue];
[dataArray addObject:place];
}
}
return dataArray;
}