开发者

iPhone/iPad - Problem with Copy values of NSArray into NSMutableArray?

This code is the search code

- (void) searchTableView {
 NSLog(@"4");
 NSString *searchText = searchBar.text;
 NSMutableArray *searchArray = [[NSMutableArray alloc] init];

 for (NSDictionary *dictionary in listOfItems)
 {
  NSArray *array = [dictionary objectForKey:@"Countries"];
  [searchArray addObjectsFromArray:array];
 }

 for (NSString *sTemp in searchArray)
 {
  NSRange titleResultsRange = [sTemp rangeOfString:searchText options:NSCaseInsensitiveS开发者_如何学JAVAearch];

  if (titleResultsRange.length > 0)
   [copyListOfItems addObject:sTemp];
 }
 //NSLog(@"Count - %d",[copyListOfItems count]);
 [searchArray release];
 searchArray = nil;
}

I want to implement this type of search in my array but i am getting error in below line.

[searchArray addObjectsFromArray:array]; 

when control comes on this line application shutdown every time can any one help me ?

Thanks


That line will give you an error only if array has nothing in it(nil value).

So check what is the value of array using nslog.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜